mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-20 23:12:13 +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 = {
|
type Props = {
|
||||||
className?: string,
|
className?: string,
|
||||||
title?: string;
|
title?: string | (() => string);
|
||||||
options: MultiselectMenuOption[];
|
options: MultiselectMenuOption[];
|
||||||
selectedOption?: MultiselectMenuOption;
|
selectedOption?: MultiselectMenuOption;
|
||||||
onSelect: (value: number) => void;
|
onSelect: (value: number) => void;
|
||||||
|
|
@ -35,7 +35,11 @@ const MultiselectMenu = ({ className, title, options, selectedOption, onSelect }
|
||||||
aria-haspopup='listbox'
|
aria-haspopup='listbox'
|
||||||
aria-expanded={menuOpen}
|
aria-expanded={menuOpen}
|
||||||
>
|
>
|
||||||
{title}
|
{
|
||||||
|
typeof title === 'function'
|
||||||
|
? title()
|
||||||
|
: title ?? selectedOption?.label
|
||||||
|
}
|
||||||
<Icon name={'caret-down'} className={classNames(styles['icon'], { [styles['open']]: menuOpen })} />
|
<Icon name={'caret-down'} className={classNames(styles['icon'], { [styles['open']]: menuOpen })} />
|
||||||
</Button>
|
</Button>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue