diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.stories.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.stories.tsx index 7ad246deaa6..99457b6c3b9 100644 --- a/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.stories.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.stories.tsx @@ -9,7 +9,7 @@ export default { component: CardRadioGroup, } as ComponentMeta; -type Value = '1' | '2' | '3'; +type Value = '1' | '2' | '3' | '4' | '5' | '6' | '7'; const data: { value: Value; title: string; body: string }[] = [ { value: '1', title: 'Radio-1', body: 'Description of radio-1' }, @@ -33,12 +33,51 @@ export const WithThreeCardWithoutValue: Story = () => { return onChange={action('select')} items={data} />; }; +export const WithThreeCardVerticalWithoutValue: Story = () => { + return ( + + onChange={action('select')} + items={data} + orientation="vertical" + /> + ); +}; + export const WithThreeCardWithValue: Story = () => { return ( onChange={action('select')} items={data} value="1" /> ); }; +export const WithThreeCardVerticalWithValue: Story = () => { + return ( + + onChange={action('select')} + items={data} + value="1" + orientation="vertical" + /> + ); +}; + +export const WithSevenCardWithValue: Story = () => { + return ( + + onChange={action('select')} + items={[ + { value: '1', title: 'Radio-1', body: 'Description of radio-1' }, + { value: '2', title: 'Radio-2', body: 'Description of radio-2' }, + { value: '3', title: 'Radio-3', body: 'Description of radio-3' }, + { value: '4', title: 'Radio-4', body: 'Description of radio-4' }, + { value: '5', title: 'Radio-5', body: 'Description of radio-5' }, + { value: '6', title: 'Radio-6', body: 'Description of radio-6' }, + { value: '7', title: 'Radio-7', body: 'Description of radio-7' }, + ]} + value="1" + /> + ); +}; + export const Playground: Story = () => { const [selected, setSelected] = React.useState(undefined); diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.tsx index bfdfffa2475..ec02162f859 100644 --- a/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/new-components/CardRadioGroup/CardRadioGroup.tsx @@ -11,6 +11,7 @@ interface CardRadioGroupProps { value?: T; items: Array>; disabled?: boolean; + orientation?: 'horizontal' | 'vertical'; onChange: (option: T) => void; } @@ -18,13 +19,15 @@ export const CardRadioGroup = ( props: CardRadioGroupProps ) => { const { value, items, disabled = false, onChange } = props; - const isCardNumberLessThenThree = items?.length === 1 || items?.length === 2; return (
{items.map(item => { const { value: iValue, title, body } = item;