mirror of
https://github.com/immich-app/static-pages.git
synced 2026-09-30 13:23:05 +08:00
fix: overflow menu items (#538)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { ExampleActions, exampleActions } from '$lib/constants.js';
|
||||
import { ActionBar, ControlBarHeader, ControlBarTitle, Stack } from '@immich/ui';
|
||||
import { ActionBar, ControlBarHeader, ControlBarTitle, MenuItemType, Stack } from '@immich/ui';
|
||||
|
||||
const onClose = () => {};
|
||||
</script>
|
||||
@@ -15,7 +15,7 @@
|
||||
<ActionBar
|
||||
{onClose}
|
||||
actions={[ExampleActions.Share, ExampleActions.Copy, ExampleActions.Download]}
|
||||
overflowActions={[ExampleActions.Edit, ExampleActions.Delete]}
|
||||
overflowActions={[ExampleActions.Edit, MenuItemType.Divider, ExampleActions.Delete]}
|
||||
>
|
||||
<ControlBarHeader>
|
||||
<ControlBarTitle>2 Selected</ControlBarTitle>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
ControlBarTitle,
|
||||
Heading,
|
||||
ImageCarousel,
|
||||
MenuItemType,
|
||||
NavbarItem,
|
||||
Stack,
|
||||
} from '@immich/ui';
|
||||
@@ -58,7 +59,12 @@
|
||||
<div class="border">
|
||||
<AppShell class="h-[400px]">
|
||||
<AppShellBar>
|
||||
<ActionBar static closeIcon={mdiArrowLeft} onClose={() => {}} overflowActions={[ExampleActions.Delete]}>
|
||||
<ActionBar
|
||||
static
|
||||
closeIcon={mdiArrowLeft}
|
||||
onClose={() => {}}
|
||||
overflowActions={[ExampleActions.Download, MenuItemType.Divider, ExampleActions.Delete]}
|
||||
>
|
||||
<ControlBarHeader>
|
||||
<ControlBarTitle>Mich's photos</ControlBarTitle>
|
||||
</ControlBarHeader>
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
import ControlBar from '$lib/components/ControlBar/ControlBar.svelte';
|
||||
import ControlBarOverflow from '$lib/components/ControlBar/ControlBarOverflow.svelte';
|
||||
import type { ActionBarProps } from '$lib/types.js';
|
||||
import { isEnabled } from '$lib/utilities/common.js';
|
||||
import { isEnabled, isMenuItemType } from '$lib/utilities/common.js';
|
||||
|
||||
const { actions = [], overflowActions = [], children, ...restProps }: ActionBarProps = $props();
|
||||
|
||||
const items = $derived(overflowActions.filter((action) => isEnabled(action)));
|
||||
const items = $derived(
|
||||
overflowActions.filter((action) => action !== undefined && (isMenuItemType(action) || isEnabled(action))),
|
||||
);
|
||||
</script>
|
||||
|
||||
<ControlBar {...restProps}>
|
||||
|
||||
@@ -428,7 +428,7 @@ export type ControlBarProps = {
|
||||
|
||||
export type ActionBarProps = ControlBarProps & {
|
||||
actions?: ActionItem[];
|
||||
overflowActions?: ActionItem[];
|
||||
overflowActions?: MenuItems;
|
||||
};
|
||||
|
||||
export type ChildContext = {
|
||||
|
||||
Reference in New Issue
Block a user