'use client'; import React from 'react'; import { usePathname } from 'next/navigation'; export const PDFDownloadBlock: React.FC<{ label: string; style: string }> = ({ label, style }) => { const pathname = usePathname(); // Extract slug from pathname const segments = pathname.split('/').filter(Boolean); // Pathname is usually /[locale]/[slug] or /[locale]/products/[slug] // We want the page slug. const slug = segments[segments.length - 1] || 'home'; const href = `/api/pages/${slug}/pdf`; return (
📄 {label}
); };