🖼️ update group icons, hide item icons in expanded sidebar details, chevron-right rotate
Browse files at this commitaca0494bf7dbbcf62b60e239c73cbd608c2566bbParent: 7a1b27e- refactor
- 🖼️ update group icons, hide item icons in expanded sidebar details, chevron-right rotate
2 changed files +25 -12
src/components/layout/nav-items.tsmodified+8 -4
| @@ -10,11 +10,15 @@ import { | ||
| 10 | 10 | IconClock, |
| 11 | 11 | IconClipboardCheck, |
| 12 | 12 | IconExam, |
| 13 | + IconGlobe, | |
| 14 | + IconGrid, | |
| 15 | + IconGuide, | |
| 13 | 16 | IconHelpCircle, |
| 14 | 17 | IconHomework, |
| 15 | 18 | IconHome, |
| 16 | 19 | IconMessage, |
| 17 | 20 | IconNote, |
| 21 | + IconReportAnalytics, | |
| 18 | 22 | IconSchool, |
| 19 | 23 | IconSettings, |
| 20 | 24 | IconUserCog, |
| @@ -115,7 +119,7 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 115 | 119 | { |
| 116 | 120 | id: "classes", |
| 117 | 121 | labelKey: "nav.group.classes", |
| 118 | - Icon: IconSchool, | |
| 122 | + Icon: IconGuide, | |
| 119 | 123 | items: [ |
| 120 | 124 | CLASSES_ITEM, |
| 121 | 125 | { id: "homework", to: "/homework", labelKey: "nav.homework", Icon: IconHomework }, |
| @@ -132,7 +136,7 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 132 | 136 | { |
| 133 | 137 | id: "students", |
| 134 | 138 | labelKey: "nav.group.students", |
| 135 | - Icon: IconUsers, | |
| 139 | + Icon: IconReportAnalytics, | |
| 136 | 140 | items: [ |
| 137 | 141 | STUDENTS_ITEM, |
| 138 | 142 | CHILDREN_ITEM, |
| @@ -144,7 +148,7 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 144 | 148 | { |
| 145 | 149 | id: "workspace", |
| 146 | 150 | labelKey: "nav.group.community", |
| 147 | - Icon: IconMessage, | |
| 151 | + Icon: IconGlobe, | |
| 148 | 152 | items: [ |
| 149 | 153 | MEALS_ITEM, |
| 150 | 154 | { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage }, |
| @@ -155,7 +159,7 @@ const NAV_GROUPS: NavGroup[] = [ | ||
| 155 | 159 | { |
| 156 | 160 | id: "school", |
| 157 | 161 | labelKey: "nav.group.school", |
| 158 | - Icon: IconSchool, | |
| 162 | + Icon: IconGrid, | |
| 159 | 163 | items: [ |
| 160 | 164 | SCHOOL_ITEM, |
| 161 | 165 | { id: "staff-work", to: "/management/staff-work", labelKey: "nav.staffWork", Icon: IconBriefcase, minRole: "manager" }, |
src/components/layout/side-nav.tsxmodified+17 -8
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | import { For, Show } from "solid-js"; |
| 2 | 2 | import { Link, useRouterState } from "@tanstack/solid-router"; |
| 3 | 3 | import { primaryNavItems, routeNavItem, sidebarNavGroups, type NavItem } from "@/components/layout/nav-items"; |
| 4 | -import { IconChevronDown } from "@/components/ui/icons"; | |
| 4 | +import { IconChevronRight } from "@/components/ui/icons"; | |
| 5 | 5 | import { cn } from "@/lib/cn"; |
| 6 | 6 | import { useAuth } from "@/stores/auth-context"; |
| 7 | 7 | import { useShellFeed } from "@/stores/shell-feed-context"; |
| @@ -66,7 +66,7 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 66 | 66 | // rail falls through to the icon-only section below. |
| 67 | 67 | const dropdown = () => !props.collapsed; |
| 68 | 68 | const active = () => group.items.some((item) => current()?.id === item.id); |
| 69 | - const links = ( | |
| 69 | + const renderLinks = (showIcon: boolean) => ( | |
| 70 | 70 | <div class="grid gap-1"> |
| 71 | 71 | <For each={group.items}> |
| 72 | 72 | {(item: NavItem) => { |
| @@ -85,7 +85,9 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 85 | 85 | : "text-muted-foreground hover:bg-muted/70 hover:text-foreground", |
| 86 | 86 | )} |
| 87 | 87 | > |
| 88 | - <item.Icon class="h-4 w-4 shrink-0" /> | |
| 88 | + <Show when={showIcon}> | |
| 89 | + <item.Icon class="h-4 w-4 shrink-0" /> | |
| 90 | + </Show> | |
| 89 | 91 | <span class={props.collapsed ? "sr-only" : "truncate"}>{t(item.labelKey)}</span> |
| 90 | 92 | <Show when={badgeFor(item) > 0}> |
| 91 | 93 | <Show |
| @@ -115,17 +117,24 @@ export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) | ||
| 115 | 117 | <h2 class={props.collapsed ? "sr-only" : "mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground"}> |
| 116 | 118 | {t(group.labelKey)} |
| 117 | 119 | </h2> |
| 118 | - {links} | |
| 120 | + {renderLinks(true)} | |
| 119 | 121 | </section> |
| 120 | 122 | } |
| 121 | 123 | > |
| 122 | - <details class="group/nav mt-3 border-t border-border/60 pt-2 dark:border-white/8" open={active()}> | |
| 123 | - <summary class="flex h-9 cursor-pointer list-none items-center gap-3 rounded-lg px-3 text-[13px] font-semibold text-muted-foreground outline-hidden transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"> | |
| 124 | + <details class="group/nav mt-1" open={active()}> | |
| 125 | + <summary | |
| 126 | + class={cn( | |
| 127 | + "flex h-9 cursor-pointer list-none items-center gap-3 rounded-lg px-3 text-[13px] font-medium outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", | |
| 128 | + active() | |
| 129 | + ? "bg-muted/70 text-foreground" | |
| 130 | + : "text-muted-foreground hover:bg-muted/70 hover:text-foreground", | |
| 131 | + )} | |
| 132 | + > | |
| 124 | 133 | <group.Icon class="h-4 w-4 shrink-0" /> |
| 125 | 134 | <span class="truncate">{t(group.labelKey)}</span> |
| 126 | - <IconChevronDown class="ml-auto h-3.5 w-3.5 transition-transform group-open/nav:rotate-180" /> | |
| 135 | + <IconChevronRight class="ml-auto h-3.5 w-3.5 shrink-0 opacity-60 transition-transform duration-200 group-open/nav:rotate-90" /> | |
| 127 | 136 | </summary> |
| 128 | - <div class="ml-3 mt-1 border-l border-border/70 pl-2">{links}</div> | |
| 137 | + <div class="mt-1 ml-[1.15rem] border-l border-border/70 pl-2">{renderLinks(false)}</div> | |
| 129 | 138 | </details> |
| 130 | 139 | </Show> |
| 131 | 140 | ); |