'use client'; import { cn } from '@/lib/utils'; import { useEffect, useState } from 'react'; import { usePathname } from 'next/navigation'; import { useRouter } from 'next/navigation'; import * as React from 'react'; import * as SelectPrimitive from '@radix-ui/react-select'; import { Select, SelectContent, SelectTriggerUpDown, } from '@/components/shared/ui/select'; import { Check, SquareArrowOutUpRightIcon } from 'lucide-react'; const SelectItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, children, ...props }, ref) => ( {children} )); SelectItem.displayName = SelectPrimitive.Item.displayName; export const TemplateSelectorDropdown = ({ children, className = '', triggerClassName = '', basePath = 'demo/landing-page-templates/template', }: { children?: React.ReactNode; className?: string; triggerClassName?: string; basePath?: string; }) => { const [isClient, setIsClient] = useState(false); const pathname = usePathname() || ''; const router = useRouter(); const THEMES = [ { name: ( All Templates {' '} ), value: 'demo/landing-page-templates', }, { name: 'Gnomie AI', value: `${basePath}/gnomie-ai`, }, { name: 'Specta', value: `${basePath}/specta`, }, { name: 'Emerald AI', value: `${basePath}/emerald-ai`, }, { name: 'Front Centre', value: `${basePath}/front-centre`, }, // { // name: 'Portrails', // value: `${basePath}/portrails`, // }, // { // name: 'Honey Dew', // value: `${basePath}/honey-dew`, // }, { name: 'ScreenshotTwo', value: `${basePath}/screenshot-two`, }, { name: 'Minimum Via', value: `${basePath}/minimum-via`, }, ]; const onChange = (value: string) => { router.push(`/${value}`); }; useEffect(() => { setIsClient(true); }, []); const pathNameWithoutSlash = pathname.replace('/', ''); const themeName = THEMES.find((theme) => theme.value === pathNameWithoutSlash) ?.name; return (
); };