mirror of https://github.com/acid-info/lsd.git
feat: add support for custom menu properties in Dropdown component
This commit is contained in:
parent
07fb14ae8e
commit
65bebb8326
|
@ -7,7 +7,7 @@ import {
|
||||||
} from '../../utils/useCommonProps'
|
} from '../../utils/useCommonProps'
|
||||||
import { SelectOption, useSelect } from '../../utils/useSelect'
|
import { SelectOption, useSelect } from '../../utils/useSelect'
|
||||||
import { DropdownItem } from '../DropdownItem'
|
import { DropdownItem } from '../DropdownItem'
|
||||||
import { DropdownMenu } from '../DropdownMenu'
|
import { DropdownMenu, DropdownMenuProps } from '../DropdownMenu'
|
||||||
import { ChevronDownIcon, ChevronUpIcon, ErrorIcon } from '../Icons'
|
import { ChevronDownIcon, ChevronUpIcon, ErrorIcon } from '../Icons'
|
||||||
import { Portal } from '../PortalProvider/Portal'
|
import { Portal } from '../PortalProvider/Portal'
|
||||||
import { Typography } from '../Typography'
|
import { Typography } from '../Typography'
|
||||||
|
@ -34,6 +34,8 @@ export type DropdownProps = CommonProps &
|
||||||
variant?: 'outlined' | 'underlined'
|
variant?: 'outlined' | 'underlined'
|
||||||
isOpen?: boolean
|
isOpen?: boolean
|
||||||
onToggle?: (open: boolean) => void
|
onToggle?: (open: boolean) => void
|
||||||
|
|
||||||
|
menuProps?: Partial<DropdownMenuProps>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Dropdown: React.FC<DropdownProps> & {
|
export const Dropdown: React.FC<DropdownProps> & {
|
||||||
|
@ -52,6 +54,7 @@ export const Dropdown: React.FC<DropdownProps> & {
|
||||||
variant = 'outlined',
|
variant = 'outlined',
|
||||||
isOpen,
|
isOpen,
|
||||||
onToggle,
|
onToggle,
|
||||||
|
menuProps = {},
|
||||||
...props
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const commonProps = useCommonProps(props)
|
const commonProps = useCommonProps(props)
|
||||||
|
@ -168,6 +171,7 @@ export const Dropdown: React.FC<DropdownProps> & {
|
||||||
onClose={() => handleToggle(false)}
|
onClose={() => handleToggle(false)}
|
||||||
size={size}
|
size={size}
|
||||||
genericFontFamily={props.genericFontFamily}
|
genericFontFamily={props.genericFontFamily}
|
||||||
|
{...menuProps}
|
||||||
>
|
>
|
||||||
{options.map((opt) => (
|
{options.map((opt) => (
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
|
|
Loading…
Reference in New Issue