Svelte 5, renaming

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2026-03-17 00:09:32 +01:00
parent 909d61525a
commit 34b1820e51
5 changed files with 20 additions and 16 deletions

View File

@@ -1,13 +1,16 @@
<script lang="ts"> <script lang="ts">
import { Menu } from "lucide-svelte"; import { Menu } from "lucide-svelte";
import type { Snippet } from "svelte";
import type { NavItem } from "../types/nav"; import type { NavItem } from "../types/nav";
let { let {
title = "", title = "",
navLinks = [], navLinks = [],
action,
}: { }: {
title?: string; title?: string;
navLinks?: NavItem[]; navLinks?: NavItem[];
action?: Snippet;
} = $props(); } = $props();
</script> </script>
@@ -53,7 +56,8 @@
<li> <li>
<a href={sublink.href} class="flex items-center gap-2"> <a href={sublink.href} class="flex items-center gap-2">
{#if sublink.icon} {#if sublink.icon}
<svelte:component this={sublink.icon} size={16} /> {@const Icon = sublink.icon}
<Icon size={16} />
{/if} {/if}
{sublink.label} {sublink.label}
</a> </a>
@@ -64,7 +68,8 @@
{:else} {:else}
<a href={link.href} class="flex items-center gap-2"> <a href={link.href} class="flex items-center gap-2">
{#if link.icon} {#if link.icon}
<svelte:component this={link.icon} size={18} /> {@const Icon = link.icon}
<Icon size={18} />
{/if} {/if}
{link.label} {link.label}
</a> </a>
@@ -75,7 +80,7 @@
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<slot name="action"></slot> {@render action?.()}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { User, Lock, Check, MessageCircle } from "lucide-svelte"; import { User, Lock, Check, MessageCircle } from "lucide-svelte";
import type { Result } from "src/types/nav"; import type { Result } from "src/types/result";
let { result }: { result: Result} = $props(); let { result }: { result: Result} = $props();

View File

@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { onMount } from "svelte"; import { onMount } from "svelte";
import Result from "./Result.svelte"; import Result from "./Result.svelte";
import type { Result as ResultType } from "src/types/nav"; import type { Result as ResultType } from "src/types/result";
import { Search } from "lucide-svelte"; import { Search } from "lucide-svelte";
import DefaultView from "./DefaultView.svelte"; import DefaultView from "./DefaultView.svelte";
import NotFoundView from "./NotFoundView.svelte"; import NotFoundView from "./NotFoundView.svelte";

View File

@@ -4,14 +4,3 @@ export interface NavItem {
icon?: any; icon?: any;
children?: NavItem[]; children?: NavItem[];
} }
export interface Result {
manufacturer: string;
name: string;
icon: string;
tags: string[];
version: string;
comment: string;
user: string;
pass: string;
}

10
src/types/result.ts Normal file
View File

@@ -0,0 +1,10 @@
export interface Result {
manufacturer: string;
name: string;
icon: string;
tags: string[];
version: string;
comment: string;
user: string;
pass: string;
}