"use client"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@mdxui/primitives"; import { AlignLeft, Calendar, CheckSquare, Circle, Hash, Link, Mail, Sliders, Star, ToggleLeft, Type, } from "lucide-react"; import type * as React from "react"; import type { QuestionType } from "./types"; interface QuestionTypeSelectorProps { onSelect: (type: QuestionType) => void; children: React.ReactNode; } const questionTypes: { type: QuestionType; label: string; icon: React.ElementType; }[] = [ { type: "text", label: "Short Text", icon: Type }, { type: "textarea", label: "Long Text", icon: AlignLeft }, { type: "number", label: "Number", icon: Hash }, { type: "email", label: "Email", icon: Mail }, { type: "url", label: "URL", icon: Link }, { type: "single-choice", label: "Single Choice", icon: Circle }, { type: "multiple-choice", label: "Multiple Choice", icon: CheckSquare }, { type: "rating", label: "Rating", icon: Star }, { type: "scale", label: "Scale", icon: Sliders }, { type: "date", label: "Date", icon: Calendar }, { type: "boolean", label: "Yes/No", icon: ToggleLeft }, ]; export function QuestionTypeSelector({ onSelect, children, }: QuestionTypeSelectorProps) { return ( {children} {questionTypes.slice(0, 5).map(({ type, label, icon: Icon }) => ( onSelect(type)}> {label} ))} {questionTypes.slice(5).map(({ type, label, icon: Icon }) => ( onSelect(type)}> {label} ))} ); }