2024-10-08 14:22:13 +00:00
|
|
|
import { Fragment } from 'react'
|
2024-02-23 11:23:32 +00:00
|
|
|
import type { Meta } from '@storybook/react'
|
2024-03-27 10:53:54 +00:00
|
|
|
import { useTranslation } from 'react-i18next'
|
2024-10-08 14:22:13 +00:00
|
|
|
import {
|
|
|
|
Dropdown,
|
|
|
|
DropdownHeader,
|
|
|
|
DropdownItem,
|
|
|
|
DropdownMenu,
|
|
|
|
DropdownToggle,
|
|
|
|
} from '@/features/ui/components/bootstrap-5/dropdown-menu'
|
|
|
|
import Button from '@/features/ui/components/bootstrap-5/button'
|
|
|
|
import { ButtonGroup } from 'react-bootstrap-5'
|
2024-02-23 11:23:32 +00:00
|
|
|
|
2024-10-08 14:22:13 +00:00
|
|
|
type Args = React.ComponentProps<typeof Dropdown>
|
2024-02-23 11:23:32 +00:00
|
|
|
|
2024-10-08 14:22:13 +00:00
|
|
|
export const Sizes = (args: Args) => {
|
2024-03-27 10:53:54 +00:00
|
|
|
const { t } = useTranslation()
|
2024-10-08 14:22:13 +00:00
|
|
|
const sizes = {
|
|
|
|
Large: 'lg',
|
|
|
|
Regular: undefined,
|
|
|
|
Small: 'sm',
|
|
|
|
} as const
|
|
|
|
const variants = ['primary', 'secondary', 'danger'] as const
|
2024-03-27 10:53:54 +00:00
|
|
|
|
2024-10-08 14:22:13 +00:00
|
|
|
return Object.entries(sizes).map(([label, size]) => (
|
|
|
|
<Fragment key={`${label}-${size}`}>
|
|
|
|
<h4>{label}</h4>
|
|
|
|
<div style={{ display: 'inline-flex', gap: '10px' }}>
|
|
|
|
{variants.map(variant => (
|
|
|
|
<Dropdown key={variant} as={ButtonGroup}>
|
|
|
|
<Button variant={variant} size={size}>
|
|
|
|
Split Button
|
|
|
|
</Button>
|
|
|
|
<DropdownToggle
|
|
|
|
split
|
|
|
|
variant={variant}
|
|
|
|
id={`split-btn-${variant}-${size}`}
|
|
|
|
size={size}
|
|
|
|
aria-label={t('expand')}
|
|
|
|
/>
|
|
|
|
<DropdownMenu>
|
|
|
|
<DropdownHeader>Header</DropdownHeader>
|
|
|
|
<DropdownItem as="button">Action 1</DropdownItem>
|
|
|
|
<DropdownItem as="button">Action 2</DropdownItem>
|
|
|
|
<DropdownItem as="button">Action 3</DropdownItem>
|
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
</Fragment>
|
|
|
|
))
|
2024-02-23 11:23:32 +00:00
|
|
|
}
|
2024-10-08 14:22:13 +00:00
|
|
|
const meta: Meta<typeof Dropdown> = {
|
2024-02-23 11:23:32 +00:00
|
|
|
title: 'Shared/Components/Bootstrap 5/SplitButton',
|
2024-10-08 14:22:13 +00:00
|
|
|
component: Dropdown,
|
2024-02-23 11:23:32 +00:00
|
|
|
args: {
|
|
|
|
align: { sm: 'start' },
|
|
|
|
},
|
|
|
|
parameters: {
|
|
|
|
bootstrap5: true,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
export default meta
|