refactor menu to use dropdown component

This commit is contained in:
Chris Kruining 2025-01-07 14:04:02 +01:00
parent 096d4c2651
commit 9d943c1182
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
4 changed files with 25 additions and 79 deletions

View file

@ -21,8 +21,6 @@ export function Dropdown(props: DropdownProps) {
const [dialog, setDialog] = createSignal<HTMLDialogElement>();
const [open, setOpen] = createSignal<boolean>(props.open ?? false);
const showCaret = createMemo(() => props.showCaret ?? true);
createEffect(() => {
dialog()?.[open() ? 'showPopover' : 'hidePopover']();
});
@ -42,7 +40,7 @@ export function Dropdown(props: DropdownProps) {
<button id={`${props.id}_button`} popoverTarget={`${props.id}_dialog`} class={css.button}>
{props.text}
<Show when={showCaret()}>
<Show when={props.showCaret}>
<FaSolidAngleDown class={css.caret} />
</Show>
</button>