import { RtButton } from '@dpa/react-buttons'; import { RtFrame } from '@dpa/react-frame-intro'; import { RtSegmentControl } from '@dpa/react-segment-control'; import { SparkTypographyIcon } from '@dpa/react-typography-icons'; import { useMemo, useState } from 'react'; const data1 = [ { id: 'id-2-1', text: 'tab 1', counter: 1, disabled: false }, { id: 'id-2-2', text: 'Длинный таб', disabled: false }, { id: 'id-2-3', text: 'tab 3', disabled: true }, ]; const dataWithIcons = [ { id: 'id-1-1', icon: SparkTypographyIcon, }, { id: 'id-1-2', icon: SparkTypographyIcon }, { id: 'id-1-3', icon: SparkTypographyIcon, disabled: true }, ]; export const SegmentControlPage = () => { const [disabled, setDisabled] = useState(false); const [activeId, setActiveId] = useState('id-2-1'); const data2 = useMemo(() => { if (disabled) { return [ { id: 'id-1-1', text: 'tab 1 tab 1 tab 1 tab 1 tab 1 ', counter: 1 }, { id: 'id-1-2', text: 'Длинный таб' }, ]; } return [ { id: 'id-1-1', text: 'tab 1', counter: 1 }, { id: 'id-1-2', text: 'Длинный таб' }, { id: 'id-1-3', text: 'tab 3', disabled: false }, ]; }, [disabled]); return (
setDisabled((s) => !s)}>----grow----
setActiveId('id-2-2')} >
--------
--------
--------
--------
--------
--------
); };