Skip to content

Commit

Permalink
wip: export selectedColor to prevent unexpected styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-basten committed Jun 12, 2024
1 parent 29d5f3e commit 2bc383a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { listNavigation } from '$lib/actions/list-navigation';
import { generateId } from '$lib/utils/generate-id';
import Portal from '$lib/components/shared-components/portal/portal.svelte';
import { selectedColor } from '$lib/components/shared-components/context-menu/menu-option.svelte';
export let icon: string;
export let title: string;
Expand Down Expand Up @@ -100,7 +101,7 @@
use:listNavigation={{
container: menuContainer,
selectedId,
selectedClass: '!bg-gray-200',
selectedClass: `!${selectedColor}`,
openDropdown,
closeDropdown,
selectionChanged: (node) => (selectedId = node?.id),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<script lang="ts" context="module">
export const selectedColor = 'bg-gray-200';
</script>

<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import { generateId } from '$lib/utils/generate-id';
Expand All @@ -24,11 +28,12 @@
};
</script>

export the name of the tailwind class for background color on hover
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li
{id}
on:click={handleClick}
class="w-full bg-slate-100 p-4 text-left text-sm font-medium text-immich-fg hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-inset dark:text-immich-dark-bg cursor-pointer border-gray-200"
class="w-full bg-slate-100 p-4 text-left text-sm font-medium text-immich-fg hover:{selectedColor} focus:outline-none focus:ring-2 focus:ring-inset dark:text-immich-dark-bg cursor-pointer border-gray-200"
class:border-t-2={topBorder}
role="menuitem"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { listNavigation } from '$lib/actions/list-navigation';
import { generateId } from '$lib/utils/generate-id';
import { setMenuContext } from '$lib/components/shared-components/context-menu/menu.context';
import { selectedColor } from '$lib/components/shared-components/context-menu/menu-option.svelte';
export let title: string;
export let direction: 'left' | 'right' = 'right';
Expand Down Expand Up @@ -100,7 +101,7 @@
use:listNavigation={{
container: contextMenuElement,
selectedId: selectedId,
selectedClass: '!bg-gray-200',
selectedClass: `!${selectedColor}`,
closeDropdown: closeContextMenu,
selectionChanged: (node) => (selectedId = node?.id),
}}
Expand Down

0 comments on commit 2bc383a

Please sign in to comment.