Skip to content

Commit 53e6910

Browse files
style(side-panel): adjust the look of the side panel
1 parent 2593e32 commit 53e6910

File tree

2 files changed

+33
-15
lines changed

2 files changed

+33
-15
lines changed

src/routes/package/[...package]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<SidePanel
7070
packageName={data.currentPackage.pkg.name}
7171
allPackages={data.displayablePackages}
72-
class="h-fit w-2/5"
72+
class="h-fit w-[35rem]"
7373
/>
7474
</div>
7575
{/await}

src/routes/package/[...package]/SidePanel.svelte

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script lang="ts">
22
import type { ClassValue } from "svelte/elements";
3+
import { ChevronRight } from "@lucide/svelte";
34
import type { CategorizedPackage } from "$lib/server/package-discoverer";
45
import { cn } from "$lib/utils";
56
import { Checkbox } from "$lib/components/ui/checkbox";
67
import { Label } from "$lib/components/ui/label";
78
import { Separator } from "$lib/components/ui/separator";
89
import * as Card from "$lib/components/ui/card";
9-
import { ChevronRight } from "@lucide/svelte";
1010
1111
type Props = {
1212
packageName?: string;
@@ -23,34 +23,52 @@
2323
</script>
2424

2525
<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">
2727
<Card.Header class="flex-row items-start justify-between">
2828
<Card.Title>Packages</Card.Title>
2929
<a
3030
href="/packages"
3131
class="group inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline"
3232
>
3333
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" />
3535
</a>
3636
</Card.Header>
3737
<Card.Content>
3838
<ul>
3939
{#each allPackages as { category, packages }, index (category)}
4040
{#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" />
4242
{/if}
4343
<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}
5472
</li>
5573
{/each}
5674
</ul>

0 commit comments

Comments
 (0)