-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: link preview timer issue (#889)
- Loading branch information
Showing
5 changed files
with
55 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"bits-ui": patch | ||
--- | ||
|
||
fix: issue with `LinkPreview` where content wouldn't close when the trigger was entered and exited quickly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,26 @@ | ||
<script lang="ts"> | ||
import { Dialog, Label, Separator } from "bits-ui"; | ||
import LockKeyOpen from "phosphor-svelte/lib/LockKeyOpen"; | ||
import X from "phosphor-svelte/lib/X"; | ||
import SelectDemo from "$lib/components/demos/select-demo.svelte"; | ||
import PopoverDemo from "$lib/components/demos/popover-demo.svelte"; | ||
import { LinkPreview } from "bits-ui"; | ||
let numbers = [1, 2, 3, 4, 5]; | ||
</script> | ||
|
||
<Dialog.Root> | ||
<Dialog.Trigger | ||
class="inline-flex h-12 items-center | ||
justify-center whitespace-nowrap rounded-input bg-dark px-[21px] | ||
text-[15px] font-semibold text-background shadow-mini transition-colors hover:bg-dark/95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-98" | ||
> | ||
New API key | ||
</Dialog.Trigger> | ||
<Dialog.Portal> | ||
<Dialog.Overlay | ||
class="fixed inset-0 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" | ||
/> | ||
<Dialog.Content | ||
class="fixed left-[50%] top-[50%] w-full max-w-[94%] translate-x-[-50%] translate-y-[-50%] rounded-card-lg border bg-background p-5 shadow-popover outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:max-w-[490px] md:w-full" | ||
> | ||
<Dialog.Title | ||
class="flex w-full items-center justify-center text-lg font-semibold tracking-tight" | ||
>Create API key</Dialog.Title | ||
<div class="flex w-full flex-col"> | ||
{#each numbers as number} | ||
<LinkPreview.Root> | ||
<LinkPreview.Trigger | ||
href="https://github.com/sveltejs" | ||
target="_blank" | ||
rel="noreferrer noopener" | ||
class="w-full border border-border p-2" | ||
> | ||
<Separator.Root class="-mx-5 mb-6 mt-5 block h-px bg-muted" /> | ||
<Dialog.Description class="text-sm text-foreground-alt"> | ||
Create and manage API keys. You can create multiple keys to organize your | ||
applications. | ||
</Dialog.Description> | ||
<SelectDemo /> | ||
<PopoverDemo /> | ||
<div class="flex flex-col items-start gap-1 pb-11 pt-7"> | ||
<Label.Root for="apiKey" class="text-sm font-medium">API Key</Label.Root> | ||
<div class="relative w-full"> | ||
<input | ||
id="apiKey" | ||
class="inline-flex h-input w-full items-center rounded-card-sm border border-border-input bg-background px-4 text-sm placeholder:text-foreground-alt/50 hover:border-dark-40 focus:outline-none focus:ring-2 focus:ring-foreground focus:ring-offset-2 focus:ring-offset-background" | ||
placeholder="secret_api_key" | ||
name="name" | ||
/> | ||
<LockKeyOpen class="absolute right-4 top-[14px] size-[22px] text-dark/30" /> | ||
</div> | ||
</div> | ||
<div class="flex w-full justify-end"> | ||
<Dialog.Close | ||
class="inline-flex h-input items-center justify-center rounded-input bg-dark px-[50px] text-[15px] font-semibold text-background shadow-mini hover:bg-dark/95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-dark focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-98" | ||
> | ||
Save | ||
</Dialog.Close> | ||
</div> | ||
<Dialog.Close | ||
class="absolute right-5 top-5 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-foreground focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-98" | ||
{number} | ||
</LinkPreview.Trigger> | ||
<LinkPreview.Content | ||
class="w-[331px] rounded-xl border border-muted bg-background p-[17px] shadow-popover" | ||
sideOffset={8} | ||
> | ||
<div> | ||
<X class="size-5 text-foreground" /> | ||
<span class="sr-only">Close</span> | ||
</div> | ||
</Dialog.Close> | ||
</Dialog.Content> | ||
</Dialog.Portal> | ||
</Dialog.Root> | ||
PREVIEW_CONTENT {number} | ||
</LinkPreview.Content> | ||
</LinkPreview.Root> | ||
{/each} | ||
</div> |