File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed
Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -42,13 +42,22 @@ const ToggleButtonGroup: React.FC<ToggleGroupProps> = ({
4242 // Current value
4343 const currentValue = value !== undefined ? value : internalValue
4444
45+ // Helper function to get selected ID
46+ const getSelectedId = (
47+ kind : 'single' | 'group' ,
48+ currentValue : string | boolean | null ,
49+ items : ToggleOption [ ]
50+ ) : string | null => {
51+ if ( kind === 'single' ) {
52+ const isFirstItemSelected =
53+ currentValue === true || currentValue === items [ 0 ] ?. id
54+ return isFirstItemSelected ? items [ 0 ] ?. id : null
55+ }
56+ return currentValue as string | null
57+ }
58+
4559 // Convert to internal format
46- const selectedId =
47- kind === 'single'
48- ? currentValue === true || currentValue === items [ 0 ] ?. id
49- ? items [ 0 ] ?. id
50- : null
51- : ( currentValue as string | null )
60+ const selectedId = getSelectedId ( kind , currentValue , items )
5261
5362 const handleChange = ( newValue : string | null ) => {
5463 const finalValue = kind === 'single' ? newValue === items [ 0 ] ?. id : newValue
Original file line number Diff line number Diff line change @@ -82,15 +82,13 @@ export const Group: Story = {
8282 < div className = "p-4 border border-gray-200 rounded-lg" >
8383 { tab === 'sold' && (
8484 < div className = "space-y-2" >
85- < h3 className = "font-semibold text-gray-900" > Ventas Panel </ h3 >
85+ < h3 className = "font-semibold text-gray-900" > Sales Dashboard </ h3 >
8686 < p className = "text-gray-600" > Showing sales data and metrics...</ p >
8787 </ div >
8888 ) }
8989 { tab === 'deeded' && (
9090 < div className = "space-y-2" >
91- < h3 className = "font-semibold text-gray-900" >
92- Escrituradas Panel
93- </ h3 >
91+ < h3 className = "font-semibold text-gray-900" > Deeded Dashboard</ h3 >
9492 < p className = "text-gray-600" > Showing deeded properties data...</ p >
9593 </ div >
9694 ) }
You can’t perform that action at this time.
0 commit comments