import Image from "next/image"; // react-hook-form import { Controller } from "react-hook-form"; // components import { FormComponentProps } from "components/custom-attributes"; // ui import { ToggleSwitch } from "components/ui"; import { Input } from "../input"; // icons import { CheckCircle2 } from "lucide-react"; // assets import NumericalRepresentation from "public/custom-attributes/number/numerical.svg"; import BarRepresentation from "public/custom-attributes/number/bar.svg"; import RingRepresentation from "public/custom-attributes/number/ring.svg"; const numberAttributeRepresentations = [ { image: NumericalRepresentation, key: "numerical", label: "Numerical", }, { image: BarRepresentation, key: "bar", label: "Bar", }, { image: RingRepresentation, key: "ring", label: "Ring", }, ]; export const NumberAttributeForm: React.FC = ({ control, watch }) => ( <>
( )} /> ( )} />
Show as
( <> {numberAttributeRepresentations.map((representation) => (
onChange(representation.key)} >
{representation.label}
{representation.label} {value === representation.key && ( )}
))} )} />
{watch && (watch("extra_settings.representation") === "bar" || watch("extra_settings.representation") === "ring") && (
<>
Divided by
( )} />
<>
Color
( )} />
<>
Show number
( )} />
)} );