~james/core

core/web/src/lib/components/search/SearchTabs.svelte -rw-r--r-- 660 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 17 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script module lang="ts">
	import { resolve } from "$app/paths";

	export const searchUrl = (type: string, q: string) =>
		resolve(`/search?type=${type}&q=${encodeURIComponent(q)}` as "/");
</script>

<script lang="ts">
	import Tabs, { type TabDef } from "#lib/components/ui/Tabs.svelte";

	interface Props {
		query: string;
		active: string;
	}

	let { query, active }: Props = $props();

	const tabs = $derived<TabDef[]>([
		{ id: "repo", label: "Repositories", href: searchUrl("repo", query) },
		{ id: "code", label: "Code", href: searchUrl("code", query) }
	]);
</script>

<Tabs {tabs} {active} label="Search type" vertical class="bg-transparent p-0" />