-
Notifications
You must be signed in to change notification settings - Fork 884
Runs page redesign #7873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Runs page redesign #7873
Changes from 45 commits
7962b74
c7370ec
d6d6893
5a96142
d290ff0
0b8681c
bacdbbb
6558efd
5eac04e
33a03f4
a98ac00
05dc037
b675281
547470a
d230b52
2bd0e18
bd5528f
35c6052
1091ac9
d2ee90e
9c14d60
e8d7940
47edc87
2369a43
c6f6746
5e2cf43
de95f4f
8570da3
7a15414
1b579df
ec3cede
8ea7362
08a21ad
f6975e3
85dc2c0
04333cd
bbb74b1
151fc9a
b140526
19eb673
e84c334
63e0f9e
db05dbb
186ebbf
b2eb6ac
3ff5261
25f27d1
8885dd9
ddabba9
ba5334d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <script lang="ts"> | ||
| type Item = { | ||
| label: string | ||
| icon?: any | ||
| right?: string | ||
| onClick?: () => void | ||
| onHover?: (hover: boolean) => void | ||
| } | ||
| export type Props = { | ||
| closeCallback?: () => void | ||
| items: Item[] | ||
| } | ||
| let { items, closeCallback }: Props = $props() | ||
| </script> | ||
|
|
||
| <ul class="bg-surface-tertiary rounded-md border w-56 relative drop-shadow-base"> | ||
| {#each items as item} | ||
| <li class="w-full"> | ||
| <button | ||
| class="px-3 h-9 text-xs cursor-pointer hover:bg-surface-hover font-normal w-full text-left flex items-center gap-2.5" | ||
| onclick={() => { | ||
| item.onClick?.() | ||
| item.onHover?.(false) | ||
| closeCallback?.() | ||
| }} | ||
| onmouseenter={() => item.onHover?.(true)} | ||
| onmouseleave={() => item.onHover?.(false)} | ||
| > | ||
| {#if item.icon} | ||
| <item.icon size="16"></item.icon> | ||
| {/if} | ||
| <span class="flex-1"> | ||
| {item.label} | ||
| </span> | ||
| {#if item.right} | ||
| <span class="text-xs text-hint">{item.right}</span> | ||
| {/if} | ||
| </button> | ||
| </li> | ||
| {/each} | ||
| {#if items.length === 0} | ||
| <li class="w-full"> | ||
| <div | ||
| class="px-3 h-9 text-xs font-normal w-full text-left flex items-center gap-2.5 text-hint" | ||
| > | ||
| No actions available | ||
| </div> | ||
| </li> | ||
| {/if} | ||
| </ul> | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| <script lang="ts"> | ||
| import { clickOutside } from '$lib/utils' | ||
| import { fly } from 'svelte/transition' | ||
| import Portal from './Portal.svelte' | ||
| import type { Snippet } from 'svelte' | ||
|
|
||
| type Props = { | ||
| children: Snippet | ||
| } | ||
|
|
||
| const { children }: Props = $props() | ||
|
|
||
| let _isOpen = $state(false) | ||
| let mousePos = $state({ x: 0, y: 0 }) | ||
| export function open(e: MouseEvent) { | ||
| e.preventDefault() | ||
| _isOpen = true | ||
| mousePos = { x: e.clientX, y: e.clientY } | ||
| console.log('Opening popover at', mousePos) | ||
diegoimbert marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| export function close() { | ||
| _isOpen = false | ||
| } | ||
| export function isOpen() { | ||
| return _isOpen | ||
| } | ||
| </script> | ||
|
|
||
| <Portal> | ||
| {#if _isOpen} | ||
| <div | ||
| in:fly={{ x: 0, y: -10, duration: 120 }} | ||
| use:clickOutside={{ | ||
| onClickOutside: (e) => { | ||
| _isOpen = false | ||
| e.preventDefault() | ||
| e.stopPropagation() | ||
|
Comment on lines
+34
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Calling |
||
| } | ||
| }} | ||
| class="absolute left-0 top-0 z-[9999] w-fit" | ||
| style="transform: translate({mousePos.x + 2}px, {mousePos.y + 2}px)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The popover is positioned using |
||
| > | ||
| {@render children()} | ||
| </div> | ||
| {/if} | ||
| </Portal> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
icontype isany— consider typing this more specifically (e.g.,typeof import('lucide-svelte').IconorComponent) for better type safety and IDE support.