(
_values: Record<string, unknown> = {},
)
| 43 | }; |
| 44 | |
| 45 | export const toggleGroupExampleCode = ( |
| 46 | _values: Record<string, unknown> = {}, |
| 47 | ): string => { |
| 48 | return `import { Cursor } from "@/components/remocn/cursor"; |
| 49 | import { useCursorPath } from "@/components/remocn/use-cursor-path"; |
| 50 | import { ToggleGroup } from "@/components/remocn/toggle-group"; |
| 51 | import { useToggleGroupTransition } from "@/components/remocn/use-toggle-group-transition"; |
| 52 | |
| 53 | // Default size geometry: pad=4, segMinWidth=88, 2 segments → container 184px wide. |
| 54 | // Centered on a 1280×720 canvas; adjust for your own canvas and segment count. |
| 55 | const MONTHLY_X = 596; |
| 56 | const YEARLY_X = 684; |
| 57 | const TOGGLE_Y = 360; |
| 58 | |
| 59 | export const Scene = () => { |
| 60 | // Cursor eases to "Yearly", clicks, then eases to "Monthly" and clicks again. |
| 61 | const cursorStyle = useCursorPath([ |
| 62 | { at: 0, x: 80, y: 60 }, |
| 63 | { at: 32, x: YEARLY_X, y: TOGGLE_Y, duration: 28 }, |
| 64 | { at: 44, x: YEARLY_X, y: TOGGLE_Y, click: true, duration: 0 }, |
| 65 | { at: 80, x: MONTHLY_X, y: TOGGLE_Y, duration: 20 }, |
| 66 | { at: 90, x: MONTHLY_X, y: TOGGLE_Y, click: true, duration: 0 }, |
| 67 | ]); |
| 68 | |
| 69 | // Toggle slides "Monthly" → "Yearly" → "Monthly", frame-synced with cursor clicks. |
| 70 | const toggleStyle = useToggleGroupTransition([ |
| 71 | { at: 46, state: "Yearly", duration: 14 }, |
| 72 | { at: 92, state: "Monthly", duration: 14 }, |
| 73 | ]); |
| 74 | |
| 75 | return ( |
| 76 | <div style={{ position: "relative", width: "100%", height: "100%" }}> |
| 77 | <ToggleGroup style={toggleStyle} /> |
| 78 | <Cursor style={cursorStyle} variant="pointer" /> |
| 79 | </div> |
| 80 | ); |
| 81 | };`; |
| 82 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected