"use client"; import { memo } from "react"; import Icon from "../../asset/icon"; import Vertical from "../../buttons/Vertical"; import { ADD_CUSTOM_FIELD_TYPE_ICONS, type AddCustomFieldType, type AddCustomFieldViewProps, } from "./AddCustomField.types"; function FieldTypeButton({ type, label, onSelect, }: { type: AddCustomFieldType; label: string; onSelect?: (t: AddCustomFieldType) => void; }) { return ( onSelect?.(type)} > {label} ); } /** * Stable block height for collapsed vs expanded so the Create dialog (`top-1/2 -translate-y-1/2`) * does not shrink and re-center when toggling `active`. * * - Collapsed CTA: `py-12` (48+48) + inner row (`py-3` + 20px icon/line) ≈ 140px border-box. * - Expanded: inner `p-4` (32) + Vertical tile (py 12+12, gap 8, 32px icon, 18px label) ≈ 114px — shorter without this floor. */ const ADD_CUSTOM_FIELD_SHELL_MIN_H_PX = 140; function AddCustomFieldViewComponent({ active, onPressAdd, onSelectFieldType, ctaLabel, fieldTypeLabels, className, }: AddCustomFieldViewProps) { const shellStyle = { minHeight: ADD_CUSTOM_FIELD_SHELL_MIN_H_PX, } as const; if (!active) { return ( ); } const expandedShellClasses = ["flex w-full shrink-0 flex-col", className ?? ""] .join(" ") .trim(); return (
); } export const AddCustomFieldView = memo(AddCustomFieldViewComponent); AddCustomFieldView.displayName = "AddCustomFieldView";