From ac3b74960506be3f7d9b03e558e6e60b8ce6af4a Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Thu, 6 Nov 2025 10:06:37 -0600 Subject: [PATCH] feat(worksheets): redesign display options as toggle buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace standard checkboxes with Radix UI toggle buttons: - Two-column grid layout for space efficiency - Animated switch indicators with proper left-to-right animation - Updated descriptions to explain pedagogical benefits (WHY) - Uniform heights for consistent visual alignment - Ten-Frames sub-control integrated into parent toggle - Outer container for styling, checkbox button for interaction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../addition/components/ConfigPanel.tsx | 367 +++++++++++------- 1 file changed, 221 insertions(+), 146 deletions(-) diff --git a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx index 6bbbb008..529bc2d7 100644 --- a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx +++ b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx @@ -1,5 +1,6 @@ 'use client' +import * as Checkbox from '@radix-ui/react-checkbox' import * as Slider from '@radix-ui/react-slider' import { useTranslations } from 'next-intl' import { css } from '../../../../../../styled-system/css' @@ -12,6 +13,114 @@ interface ConfigPanelProps { onChange: (updates: Partial) => void } +interface ToggleOptionProps { + checked: boolean + onChange: (checked: boolean) => void + label: string + description: string + children?: React.ReactNode +} + +function ToggleOption({ checked, onChange, label, description, children }: ToggleOptionProps) { + return ( +
+ +
+
+ {label} +
+
+
+
+
+
+ {description} +
+ + {children} +
+ ) +} + export function ConfigPanel({ formState, onChange }: ConfigPanelProps) { const t = useTranslations('create.worksheets.addition') @@ -571,168 +680,134 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
-
- {/* Checkboxes */} + {/* Two-column grid: toggle options on left, preview on right */} +
+ {/* Toggle Options in 2-column grid */}
-
- onChange({ showCarryBoxes: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> - -
+ onChange({ showCarryBoxes: checked })} + label="Carry Boxes" + description="Help students track regrouping during addition" + /> -
- onChange({ showAnswerBoxes: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> - -
+ onChange({ showAnswerBoxes: checked })} + label="Answer Boxes" + description="Guide students to write organized, aligned answers" + /> -
- onChange({ showPlaceValueColors: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> - -
+ onChange({ showPlaceValueColors: checked })} + label="Place Value Colors" + description="Reinforce place value understanding visually" + /> -
- onChange({ showProblemNumbers: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> - -
+ onChange({ showProblemNumbers: checked })} + label="Problem Numbers" + description="Help students track progress and reference problems" + /> -
- onChange({ showCellBorder: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> - -
+ onChange({ showCellBorder: checked })} + label="Cell Borders" + description="Organize problems visually for easier focus" + /> -
-
- onChange({ showTenFrames: e.target.checked })} - className={css({ w: '3.5', h: '3.5', cursor: 'pointer', flexShrink: 0 })} - /> -
+
{/* Live Preview */}