(
values: Record<string, unknown> = {},
)
| 27 | style={style} |
| 28 | /> |
| 29 | ); |
| 30 | }; |
| 31 | |
| 32 | export const checkboxExampleCode = ( |
| 33 | values: Record<string, unknown> = {}, |
| 34 | ): string => { |
| 35 | const label = values.label as string | undefined; |
| 36 | const size = values.size as string | undefined; |
| 37 | const primary = values.primary as string | undefined; |
| 38 | |
| 39 | const props: string[] = []; |
| 40 | if (label !== undefined && label !== "Accept terms and conditions") |
| 41 | props.push(`label="${label}"`); |
| 42 | if (size !== undefined && size !== "default") props.push(`size="${size}"`); |
| 43 | if (primary !== undefined) props.push(`primary="${primary}"`); |
| 44 | |
| 45 | const propsStr = props.length ? ` ${props.join(" ")}` : ""; |
| 46 | |
| 47 | const hookOpts: string[] = []; |
| 48 | if (primary !== undefined) hookOpts.push(`primary: "${primary}"`); |
| 49 | const optsStr = hookOpts.length ? `, { ${hookOpts.join(", ")} }` : ""; |
| 50 | |
| 51 | return `import { Checkbox } from "@/components/remocn/checkbox"; |
| 52 | import { useCheckboxTransition } from "@/components/remocn/use-checkbox-transition"; |
| 53 | |
| 54 | export const Scene = () => { |
| 55 | const style = useCheckboxTransition([ |
| 56 | { at: 18, state: "checked", duration: 14 }, |
| 57 | { at: 78, state: "unchecked", duration: 12 }, |
| 58 | ]${optsStr}); |
| 59 | |
| 60 | return <Checkbox${propsStr} style={style} />; |
| 61 | };`; |
| 62 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected