"vscode:/vscode.git/clone" did not exist on "b7c85a4ba65f05687fc1670a15ac6b81124328a0"
WebSearchResults.svelte 2.82 KB
Newer Older
Timothy J. Baek's avatar
Timothy J. Baek committed
1
2
3
<script lang="ts">
	import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
	import ChevronUp from '$lib/components/icons/ChevronUp.svelte';
4
	import MagnifyingGlass from '$lib/components/icons/MagnifyingGlass.svelte';
5
6
	import Collapsible from '$lib/components/common/Collapsible.svelte';

Timothy J. Baek's avatar
Timothy J. Baek committed
7

8
	export let status = { urls: [], query: '' };
Timothy J. Baek's avatar
Timothy J. Baek committed
9
10
11
	let state = false;
</script>

12
13
<div class="w-full space-y-1">
	<Collapsible bind:open={state}>
Timothy J. Baek's avatar
Timothy J. Baek committed
14
15
		<div
			class="flex items-center gap-2 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition"
16
			slot="head"
Timothy J. Baek's avatar
Timothy J. Baek committed
17
18
19
20
21
22
23
24
25
		>
			<slot />

			{#if state}
				<ChevronUp strokeWidth="3.5" className="size-3.5 " />
			{:else}
				<ChevronDown strokeWidth="3.5" className="size-3.5 " />
			{/if}
		</div>
26
27
28
29
30
31
32
33
34
		<div
			class="text-sm border border-gray-300/30 dark:border-gray-700/50 rounded-xl"
			slot="content"
		>
			{#if status?.query}
				<a
					href="https://www.google.com/search?q={status.query}"
					target="_blank"
					class="flex w-full items-center p-3 px-4 border-b border-gray-300/30 dark:border-gray-700/50 group/item justify-between font-normal text-gray-800 dark:text-gray-300 no-underline"
35
				>
36
37
38
39
40
41
42
43
44
45
					<div class="flex gap-2 items-center">
						<MagnifyingGlass />
		
						<div class=" line-clamp-1">
							{status.query}
						</div>
					</div>
		
					<div
						class=" ml-1 text-white dark:text-gray-900 group-hover/item:text-gray-600 dark:group-hover/item:text-white transition"
46
					>
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
						<!--  -->
						<svg
							xmlns="http://www.w3.org/2000/svg"
							viewBox="0 0 16 16"
							fill="currentColor"
							class="size-4"
						>
							<path
								fill-rule="evenodd"
								d="M4.22 11.78a.75.75 0 0 1 0-1.06L9.44 5.5H5.75a.75.75 0 0 1 0-1.5h5.5a.75.75 0 0 1 .75.75v5.5a.75.75 0 0 1-1.5 0V6.56l-5.22 5.22a.75.75 0 0 1-1.06 0Z"
								clip-rule="evenodd"
							/>
						</svg>
					</div>
				</a>
			{/if}
		
			{#each status.urls as url, urlIdx}
				<a
					href={url}
					target="_blank"
					class="flex w-full items-center p-3 px-4 {urlIdx === status.urls.length - 1
						? ''
						: 'border-b border-gray-300/30 dark:border-gray-700/50'} group/item justify-between font-normal text-gray-800 dark:text-gray-300"
Timothy J. Baek's avatar
Timothy J. Baek committed
71
				>
72
73
74
75
76
77
					<div class=" line-clamp-1">
						{url}
					</div>
		
					<div
						class=" ml-1 text-white dark:text-gray-900 group-hover/item:text-gray-600 dark:group-hover/item:text-white transition"
Timothy J. Baek's avatar
Timothy J. Baek committed
78
					>
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
						<!--  -->
						<svg
							xmlns="http://www.w3.org/2000/svg"
							viewBox="0 0 16 16"
							fill="currentColor"
							class="size-4"
						>
							<path
								fill-rule="evenodd"
								d="M4.22 11.78a.75.75 0 0 1 0-1.06L9.44 5.5H5.75a.75.75 0 0 1 0-1.5h5.5a.75.75 0 0 1 .75.75v5.5a.75.75 0 0 1-1.5 0V6.56l-5.22 5.22a.75.75 0 0 1-1.06 0Z"
								clip-rule="evenodd"
							/>
						</svg>
					</div>
				</a>
			{/each}
		</div>
	</Collapsible>	
</div>