feat(MultiselectMenu): handle title function

This commit is contained in:
Botzy 2025-02-28 17:45:13 +02:00
parent 0a6d70f3a6
commit 794f4e48ac

View file

@ -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>
{