Make sidebar group and clean up styling a bit

This commit is contained in:
Dominic Ferrando
2026-07-10 12:36:02 -04:00
parent 0ed1945b06
commit 170bde7e1b
5 changed files with 35 additions and 19 deletions
+27 -11
View File
@@ -3,11 +3,21 @@
import favicon from "$lib/assets/favicon.svg"; import favicon from "$lib/assets/favicon.svg";
import "../app.css"; import "../app.css";
const links = [ const groups = [
{ name: "Calculator", path: "/calculator" }, {
{ name: "Commerce", path: "/commerce" }, name: "Calculator",
path: "/calculator",
links: [{ name: "Configurations", path: "/configurations" }],
},
{
name: "Commerce",
path: "/commerce",
links: [{ name: "Products", path: "/products" }],
},
]; ];
const collapsed = $state(false);
let { children } = $props(); let { children } = $props();
</script> </script>
@@ -16,12 +26,9 @@
</svelte:head> </svelte:head>
<div class="drawer lg:drawer-open"> <div class="drawer lg:drawer-open">
<input id="sidebar" type="checkbox" class="drawer-toggle" /> <input id="sidebar" type="checkbox" class={collapsed ? "" : "drawer-toggle"} />
<div class="drawer-content p-10 flex flex-col items-center"> <div class="drawer-content px-5 flex flex-col items-center">
{@render children?.()} {@render children?.()}
<!-- <label for="sidebar" class="btn btn-primary drawer-button lg:hidden"> -->
<!-- Open drawer -->
<!-- </label> -->
</div> </div>
<div class="drawer-side"> <div class="drawer-side">
<label for="sidebar" aria-label="close sidebar" class="drawer-overlay" <label for="sidebar" aria-label="close sidebar" class="drawer-overlay"
@@ -29,16 +36,25 @@
<ul <ul
class="menu menu-lg bg-base-200 text-base-content min-h-full w-72 p-4" class="menu menu-lg bg-base-200 text-base-content min-h-full w-72 p-4"
> >
{#each links as link} {#each groups as group}
<li>
<h2 class="menu-title text-lg">{group.name}</h2>
<ul>
{#each group.links as link}
{@const fullPath = group.path + link.path}
<li> <li>
<a <a
class={{ class={{
"menu-active": page.url.pathname === link.path, "menu-active":
page.url.pathname === fullPath,
}} }}
href={link.path}>{link.name}</a href={fullPath}>{link.name}</a
> >
</li> </li>
{/each} {/each}
</ul> </ul>
</li>
{/each}
</ul>
</div> </div>
</div> </div>
+1 -1
View File
@@ -2,5 +2,5 @@ import { redirect } from "@sveltejs/kit";
import type { PageServerLoad } from "./$types"; import type { PageServerLoad } from "./$types";
export const load: PageServerLoad = ({ }) => { export const load: PageServerLoad = ({ }) => {
redirect(308, "/calculator"); redirect(308, "/calculator/configurations");
}; };
@@ -343,7 +343,7 @@
{@const activityParams = currentEditor.params.activity[activity]} {@const activityParams = currentEditor.params.activity[activity]}
{@const activityMetadata = allStandards.byActivity(activity).getMetadata()} {@const activityMetadata = allStandards.byActivity(activity).getMetadata()}
<div <div
class="w-full -mt-10 -mx-10 px-6 py-2 bg-base-200 border-b border-base-300 flex items-center gap-2 flex-wrap text-sm" class="w-full px-6 py-2 bg-base-200 border-b border-base-300 flex items-center gap-2 flex-wrap text-sm"
> >
<span class="label">Configuration: </span> <span class="label">Configuration: </span>
<select <select
@@ -63,7 +63,7 @@
<button <button
disabled={synchronizer.isInProgress} disabled={synchronizer.isInProgress}
onclick={() => synchronizer.syncAll()} onclick={() => synchronizer.syncAll()}
class="btn btn-xl mb-5" class="btn btn-xl mb-5 mt-10"
> >
{#if synchronizer.isInProgress} {#if synchronizer.isInProgress}
Syncing... Syncing...