mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
🛠️ Fixed eslint errors
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Component, Snippet, SvelteComponent } from "svelte";
|
import type { Component } from "svelte";
|
||||||
|
|
||||||
import { cn } from "@/utils/cn";
|
import { cn } from "@/utils/cn";
|
||||||
import CopyIcon from "@lucide/svelte/icons/copy";
|
import CopyIcon from "@lucide/svelte/icons/copy";
|
||||||
@@ -18,21 +18,17 @@
|
|||||||
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
let timeoutId: ReturnType<typeof setTimeout> | null = null;
|
||||||
|
|
||||||
const handleCopy = async () => {
|
const handleCopy = async () => {
|
||||||
try {
|
await clipboard(code);
|
||||||
await clipboard(code);
|
|
||||||
|
|
||||||
if (timeoutId) {
|
if (timeoutId) {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
|
||||||
|
|
||||||
copied = true;
|
|
||||||
timeoutId = setTimeout(() => {
|
|
||||||
copied = false;
|
|
||||||
timeoutId = null;
|
|
||||||
}, copyDuration);
|
|
||||||
} catch (error) {
|
|
||||||
copied = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copied = true;
|
||||||
|
timeoutId = setTimeout(() => {
|
||||||
|
copied = false;
|
||||||
|
timeoutId = null;
|
||||||
|
}, copyDuration);
|
||||||
};
|
};
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each categories.sort() as category}
|
{#each categories.sort() as category (category)}
|
||||||
<a
|
<a
|
||||||
href={`/directory/${category.toLowerCase()}`}
|
href={`/directory/${category.toLowerCase()}`}
|
||||||
data-sveltekit-preload-data
|
data-sveltekit-preload-data
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Select.Trigger>
|
</Select.Trigger>
|
||||||
<Select.Content sideOffset={1.5}>
|
<Select.Content sideOffset={1.5}>
|
||||||
{#each Object.entries(managers) as [value, { Icon, label }]}
|
{#each Object.entries(managers) as [value, { Icon, label }] (value)}
|
||||||
<Select.Item
|
<Select.Item
|
||||||
{value}
|
{value}
|
||||||
onclick={() => pkgManager.set(value as PackageManager)}
|
onclick={() => pkgManager.set(value as PackageManager)}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
<Dialog.Root>
|
<Dialog.Root>
|
||||||
<Dialog.Trigger>
|
<Dialog.Trigger>
|
||||||
{@render children?.()}
|
{@render children()}
|
||||||
</Dialog.Trigger>
|
</Dialog.Trigger>
|
||||||
<Dialog.Content class="text-sm">
|
<Dialog.Content class="text-sm">
|
||||||
<Dialog.Header>
|
<Dialog.Header>
|
||||||
@@ -33,6 +33,6 @@
|
|||||||
</p>
|
</p>
|
||||||
<CodeBlock code={registryCode} />
|
<CodeBlock code={registryCode} />
|
||||||
<p class="mt-2">2. Then use the following command to add SVGs:</p>
|
<p class="mt-2">2. Then use the following command to add SVGs:</p>
|
||||||
<CodeBlock code={`npx shadcn@latest add @svgl/[svg-name]`} />
|
<CodeBlock code="npx shadcn@latest add @svgl/[svg-name]" />
|
||||||
</Dialog.Content>
|
</Dialog.Content>
|
||||||
</Dialog.Root>
|
</Dialog.Root>
|
||||||
|
|||||||
@@ -143,7 +143,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<div class="flex items-center justify-center space-x-1">
|
<div class="flex items-center justify-center space-x-1">
|
||||||
{#if Array.isArray(svgInfo.category)}
|
{#if Array.isArray(svgInfo.category)}
|
||||||
{#each svgInfo.category.slice(0, maxVisibleCategories) as c, index}
|
{#each svgInfo.category.slice(0, maxVisibleCategories) as c (c)}
|
||||||
<a
|
<a
|
||||||
href={`/directory/${c.toLowerCase()}`}
|
href={`/directory/${c.toLowerCase()}`}
|
||||||
class={badgeVariants({
|
class={badgeVariants({
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
</Popover.Trigger>
|
</Popover.Trigger>
|
||||||
<Popover.Content class="flex w-auto flex-col space-y-2">
|
<Popover.Content class="flex w-auto flex-col space-y-2">
|
||||||
<p class="font-medium">More tags:</p>
|
<p class="font-medium">More tags:</p>
|
||||||
{#each svgInfo.category.slice(maxVisibleCategories) as c}
|
{#each svgInfo.category.slice(maxVisibleCategories) as c (c)}
|
||||||
<a
|
<a
|
||||||
href={`/directory/${c.toLowerCase()}`}
|
href={`/directory/${c.toLowerCase()}`}
|
||||||
class={cn(buttonVariants({ variant: "outline" }), "w-full")}
|
class={cn(buttonVariants({ variant: "outline" }), "w-full")}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
HTMLAnchorAttributes,
|
HTMLAnchorAttributes,
|
||||||
HTMLButtonAttributes,
|
HTMLButtonAttributes,
|
||||||
} from "svelte/elements";
|
} from "svelte/elements";
|
||||||
import { type VariantProps, tv } from "tailwind-variants";
|
import type { VariantProps } from "tailwind-variants";
|
||||||
import type { WithElementRef } from "@/types/components";
|
import type { WithElementRef } from "@/types/components";
|
||||||
|
|
||||||
import { cn } from "@/utils/cn";
|
import { cn } from "@/utils/cn";
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
</PageHeader>
|
</PageHeader>
|
||||||
<Container className="my-6">
|
<Container className="my-6">
|
||||||
<Grid>
|
<Grid>
|
||||||
{#each displaySvgs as svg}
|
{#each displaySvgs as svg (svg.id)}
|
||||||
<SvgCard svgInfo={svg} />
|
<SvgCard svgInfo={svg} />
|
||||||
{/each}
|
{/each}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
// States:
|
// States:
|
||||||
let searchTerm = $state<string>(data.searchTerm || "");
|
let searchTerm = $state<string>(data.searchTerm || "");
|
||||||
let filteredSvgs = $state<iSVG[]>(data.filteredSvgs);
|
let filteredSvgs = $derived<iSVG[]>(data.filteredSvgs);
|
||||||
|
|
||||||
const searchSvgs = () => {
|
const searchSvgs = () => {
|
||||||
if (!searchTerm) {
|
if (!searchTerm) {
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
</PageHeader>
|
</PageHeader>
|
||||||
<Container className="my-6">
|
<Container className="my-6">
|
||||||
<Grid>
|
<Grid>
|
||||||
{#each filteredSvgs as svg}
|
{#each filteredSvgs as svg (svg.id)}
|
||||||
<SvgCard svgInfo={svg} />
|
<SvgCard svgInfo={svg} />
|
||||||
{/each}
|
{/each}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
Reference in New Issue
Block a user