📝 docs: add segmented controls component to example page
This commit is contained in:
parent
aabda9b486
commit
7bb5f9831c
@ -13,10 +13,14 @@ import {
|
||||
renderTabs,
|
||||
renderVerticalTabs,
|
||||
} from './renders/tabs';
|
||||
import { SegmentedControls } from 'components/shared/SegmentedControls';
|
||||
import { SEGMENTED_CONTROLS_OPTIONS } from './renders/segmentedControls';
|
||||
|
||||
const Page = () => {
|
||||
const [singleDate, setSingleDate] = useState<Value>();
|
||||
const [dateRange, setDateRange] = useState<Value>();
|
||||
const [selectedSegmentedControl, setSelectedSegmentedControl] =
|
||||
useState<string>('Test 1');
|
||||
|
||||
return (
|
||||
<div className="relative h-full min-h-full">
|
||||
@ -112,6 +116,26 @@ const Page = () => {
|
||||
<h1 className="text-2xl font-bold">Vertical Tabs</h1>
|
||||
{renderVerticalTabs()}
|
||||
</div>
|
||||
|
||||
<div className="w-full h border border-gray-200 px-20 my-10" />
|
||||
|
||||
{/* Segmented Controls */}
|
||||
<div className="flex flex-col gap-10 items-center justify-between">
|
||||
<h1 className="text-2xl font-bold">Segmented Controls</h1>
|
||||
<div className="flex flex-col gap-10">
|
||||
<SegmentedControls
|
||||
options={SEGMENTED_CONTROLS_OPTIONS}
|
||||
value={selectedSegmentedControl}
|
||||
onChange={setSelectedSegmentedControl}
|
||||
/>
|
||||
<SegmentedControls
|
||||
size="sm"
|
||||
options={SEGMENTED_CONTROLS_OPTIONS}
|
||||
value={selectedSegmentedControl}
|
||||
onChange={setSelectedSegmentedControl}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,44 @@
|
||||
import React from 'react';
|
||||
import { Badge } from 'components/shared/Badge';
|
||||
import { SegmentedControlsOption } from 'components/shared/SegmentedControls';
|
||||
|
||||
export const SEGMENTED_CONTROLS_OPTIONS: SegmentedControlsOption[] = [
|
||||
{ label: 'Test 1', value: 'Test 1' },
|
||||
{
|
||||
label: 'Test 2',
|
||||
value: 'Test 2',
|
||||
leftIcon: (
|
||||
<Badge size="xs" variant="tertiary">
|
||||
1
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Test 3',
|
||||
value: 'Test 3',
|
||||
rightIcon: (
|
||||
<Badge size="xs" variant="tertiary">
|
||||
1
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Test 4',
|
||||
value: 'Test 4',
|
||||
leftIcon: (
|
||||
<Badge size="xs" variant="tertiary">
|
||||
1
|
||||
</Badge>
|
||||
),
|
||||
rightIcon: (
|
||||
<Badge size="xs" variant="tertiary">
|
||||
1
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: 'Test 5',
|
||||
value: 'Test 5',
|
||||
disabled: true,
|
||||
},
|
||||
];
|
Loading…
Reference in New Issue
Block a user