|
1 | 1 | <script lang="ts"> |
2 | 2 | import type { ClassValue } from "svelte/elements"; |
| 3 | + import { ChevronRight } from "@lucide/svelte"; |
3 | 4 | import type { CategorizedPackage } from "$lib/server/package-discoverer"; |
4 | 5 | import { cn } from "$lib/utils"; |
5 | 6 | import { Checkbox } from "$lib/components/ui/checkbox"; |
6 | 7 | import { Label } from "$lib/components/ui/label"; |
7 | 8 | import { Separator } from "$lib/components/ui/separator"; |
8 | 9 | import * as Card from "$lib/components/ui/card"; |
9 | | - import { ChevronRight } from "@lucide/svelte"; |
10 | 10 |
|
11 | 11 | type Props = { |
12 | 12 | packageName?: string; |
|
23 | 23 | </script> |
24 | 24 |
|
25 | 25 | <div class={cn("flex flex-col *:shadow-lg *:shadow-black", className)}> |
26 | | - <Card.Root class="z-10 border border-muted-foreground/50 bg-secondary"> |
| 26 | + <Card.Root class="z-10 border border-muted-foreground/25 bg-secondary"> |
27 | 27 | <Card.Header class="flex-row items-start justify-between"> |
28 | 28 | <Card.Title>Packages</Card.Title> |
29 | 29 | <a |
30 | 30 | href="/packages" |
31 | 31 | class="group inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline" |
32 | 32 | > |
33 | 33 | See all |
34 | | - <ChevronRight class="size-4 transition-transform duration-300 group-hover:translate-x-1" /> |
| 34 | + <ChevronRight class="size-4 transition-transform group-hover:translate-x-1" /> |
35 | 35 | </a> |
36 | 36 | </Card.Header> |
37 | 37 | <Card.Content> |
38 | 38 | <ul> |
39 | 39 | {#each allPackages as { category, packages }, index (category)} |
40 | 40 | {#if index > 0} |
41 | | - <Separator class="mt-3 mb-2 rounded-full bg-muted-foreground" /> |
| 41 | + <Separator class="my-2 rounded-full bg-muted-foreground" /> |
42 | 42 | {/if} |
43 | 43 | <li class="space-y-2"> |
44 | | - <h3 class="text-xl font-bold text-primary">{category.name}</h3> |
45 | | - <ul class="space-y-2"> |
46 | | - {#each packages as { pkg } (pkg.name)} |
47 | | - <li> |
48 | | - <a href="/package/{pkg.name}" class="underline-offset-4 hover:underline"> |
49 | | - {pkg.name} |
50 | | - </a> |
51 | | - </li> |
52 | | - {/each} |
53 | | - </ul> |
| 44 | + {#if packages.length > 1} |
| 45 | + <h3 class="text-xl font-bold text-primary">{category.name}</h3> |
| 46 | + <ul class="space-y-2"> |
| 47 | + {#each packages as { pkg } (pkg.name)} |
| 48 | + <li> |
| 49 | + <a |
| 50 | + href="/package/{pkg.name}" |
| 51 | + class="group inline-flex w-full items-center underline-offset-4 hover:underline" |
| 52 | + > |
| 53 | + {pkg.name} |
| 54 | + <ChevronRight |
| 55 | + class="ml-auto size-4 text-primary transition-transform group-hover:translate-x-1" |
| 56 | + /> |
| 57 | + </a> |
| 58 | + </li> |
| 59 | + {/each} |
| 60 | + </ul> |
| 61 | + {:else} |
| 62 | + <a |
| 63 | + href="/package/{packages[0]?.pkg.name}" |
| 64 | + class="group inline-flex w-full items-center text-xl font-bold text-primary underline-offset-4 hover:underline" |
| 65 | + > |
| 66 | + {category.name} |
| 67 | + <ChevronRight |
| 68 | + class="ml-auto size-4 text-primary transition-transform group-hover:translate-x-1" |
| 69 | + /> |
| 70 | + </a> |
| 71 | + {/if} |
54 | 72 | </li> |
55 | 73 | {/each} |
56 | 74 | </ul> |
|
0 commit comments