Skip to content

Commit

Permalink
fix: replace deprecated 'dropdown' with Select in Popover
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafahanafi authored and anuradha9712 committed Oct 17, 2024
1 parent 8c8bcc7 commit 3ebee27
Showing 1 changed file with 68 additions and 13 deletions.
81 changes: 68 additions & 13 deletions core/components/molecules/popover/__stories__/Layering.story.jsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,92 @@
import * as React from 'react';
import { Button, Popover, Dropdown } from '@/index';
import { Button, Popover, Select } from '@/index';

// CSF format story
const options = [
{ label: 'Draft', value: 'draft' },
{ label: 'In Progress', value: 'in_progress' },
{ label: 'Sent', value: 'sent' },
{ label: 'Scheduled', value: 'scheduled' },
{ label: 'Partially Failed', value: 'partially_failed' },
{ label: 'Completely Failed', value: 'completely_failed' },
];

export const layering = () => {
return (
<div className="mb-9">
<Popover position="bottom" on="click" trigger={<Button appearance="basic">Open Popover</Button>} open={false}>
<div className="pb-11 pr-10">
<Dropdown
className="p-6 w-100"
options={[
{ label: 'Draft', value: 'draft' },
{ label: 'In Progress', value: 'in_progress' },
{ label: 'Sent', value: 'sent' },
{ label: 'Scheduled', value: 'scheduled' },
{ label: 'Partially Failed', value: 'partially_failed' },
{ label: 'Completely Failed', value: 'completely_failed' },
]}
placeholder="Status"
/>
<Select
className="p-6"
width={100}
popoverWidth={176} /* back to default */
triggerOptions={{
placeholder: 'Status',
}}
>
<Select.List>
{options.map((option, key) => {
return (
<Select.Option key={key} option={{ label: option.label, value: option.value }}>
{option.label}
</Select.Option>
);
})}
</Select.List>
</Select>
</div>
</Popover>
</div>
);
};

const customCode = `() => {
const options = [
{ label: 'Draft', value: 'draft' },
{ label: 'In Progress', value: 'in_progress' },
{ label: 'Sent', value: 'sent' },
{ label: 'Scheduled', value: 'scheduled' },
{ label: 'Partially Failed', value: 'partially_failed' },
{ label: 'Completely Failed', value: 'completely_failed' },
];
return (
<div className="mb-9">
<Popover position="bottom" on="click" trigger={<Button appearance="basic">Open Popover</Button>} open={false}>
<div className="pb-11 pr-10">
<Select
className="p-6"
width={100}
popoverWidth={176}
triggerOptions={{
placeholder: 'Status',
}}
>
<Select.List>
{options.map((option, key) => {
return (
<Select.Option key={key} option={{ label: option.label, value: option.value }}>
{option.label}
</Select.Option>
);
})}
</Select.List>
</Select>
</div>
</Popover>
</div>
);
}
`;

export default {
title: 'Components/Popover/Layering',
component: Popover,
parameters: {
docs: {
docPage: {
noHtml: true,
customCode,
},
},
},
Expand Down

0 comments on commit 3ebee27

Please sign in to comment.