mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
feat(MultiselectMenu): handle title function
This commit is contained in:
parent
0a6d70f3a6
commit
794f4e48ac
1 changed files with 6 additions and 2 deletions
|
|
@ -11,7 +11,7 @@ import useOutsideClick from 'stremio/common/useOutsideClick';
|
|||
|
||||
type Props = {
|
||||
className?: string,
|
||||
title?: string;
|
||||
title?: string | (() => string);
|
||||
options: MultiselectMenuOption[];
|
||||
selectedOption?: MultiselectMenuOption;
|
||||
onSelect: (value: number) => void;
|
||||
|
|
@ -35,7 +35,11 @@ const MultiselectMenu = ({ className, title, options, selectedOption, onSelect }
|
|||
aria-haspopup='listbox'
|
||||
aria-expanded={menuOpen}
|
||||
>
|
||||
{title}
|
||||
{
|
||||
typeof title === 'function'
|
||||
? title()
|
||||
: title ?? selectedOption?.label
|
||||
}
|
||||
<Icon name={'caret-down'} className={classNames(styles['icon'], { [styles['open']]: menuOpen })} />
|
||||
</Button>
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue