mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
f469d8e5e3
[web] BS5 downshift in account settings page GitOrigin-RevId: acfbde3ec87ae8038e0b19ddaca35e6c7392743b
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import classNames from 'classnames'
|
|
import Button from './button'
|
|
import {
|
|
Dropdown,
|
|
DropdownItem,
|
|
DropdownMenu,
|
|
DropdownToggle,
|
|
} from './dropdown-menu'
|
|
import MaterialIcon from '@/shared/components/material-icon'
|
|
import type { SplitButtonProps } from '@/features/ui/components/types/split-button-props'
|
|
|
|
export function SplitButton({
|
|
accessibilityLabel,
|
|
align,
|
|
id,
|
|
items,
|
|
text,
|
|
variant,
|
|
...props
|
|
}: SplitButtonProps) {
|
|
const buttonClassName = classNames('split-button')
|
|
|
|
return (
|
|
<div>
|
|
<Dropdown align={align}>
|
|
<Button className={buttonClassName} variant={variant} {...props}>
|
|
<span className="split-button-content">{text}</span>
|
|
</Button>
|
|
<DropdownToggle
|
|
bsPrefix="dropdown-button-toggle"
|
|
id={id}
|
|
variant={variant}
|
|
{...props}
|
|
>
|
|
<MaterialIcon
|
|
className="split-button-caret"
|
|
type="expand_more"
|
|
accessibilityLabel={accessibilityLabel}
|
|
/>
|
|
</DropdownToggle>
|
|
<DropdownMenu>
|
|
{items.map((item, index) => (
|
|
<li key={index}>
|
|
<DropdownItem eventKey={item.eventKey}>{item.label}</DropdownItem>
|
|
</li>
|
|
))}
|
|
</DropdownMenu>
|
|
</Dropdown>
|
|
</div>
|
|
)
|
|
}
|