forge
Explore
Log in

Don't you dare go Hollow

🎨 elevate dropdowns and clean up empty state warning panels

Browse files at this commit

92aa7ebdba1fc063ecec006174b7797e690e39e0Burak BoduroğluParent: 1c0f094
  • feat
    • 🎨 elevate dropdowns and clean up empty state warning panels
Show full message
feat: 🎨 elevate dropdowns and clean up empty state warning panels
- upgrade DropdownMenu, Combobox, and Popover primitives with Apple HIG squircle containers, frosted glass blur, tactile press feedback, and 44pt touch targets
- add custom dropdown chevron indicator and rounded-xl squircle styling to native Select component
- clean up EmptyState component by eliminating inner action button slot
- remove redundant action buttons inside empty warning panels across notes, course teachers, course detail, and terms pages
- verify build and 202/202 vitest unit tests pass
src/components/courses/course-teachers-panel.tsxmodified+1 -10
@@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
8 import { ConfirmDialog } from "@/components/ui/confirm-dialog";8 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
9 import { DataTable } from "@/components/ui/data-table";9 import { DataTable } from "@/components/ui/data-table";
10 import { EmptyState } from "@/components/ui/empty-state";10 import { EmptyState } from "@/components/ui/empty-state";
11-import { IconPlus, IconTrash } from "@/components/ui/icons";11+import { IconTrash } from "@/components/ui/icons";
12 import { SidePanel } from "@/components/ui/side-panel";12 import { SidePanel } from "@/components/ui/side-panel";
13 import { UserSearchSelect } from "@/components/users/user-search-select";13 import { UserSearchSelect } from "@/components/users/user-search-select";
14 import { createFlash } from "@/lib/flash";14 import { createFlash } from "@/lib/flash";
@@ -122,15 +122,6 @@ export function CourseTeachersPanel(props: {
122 fallback={122 fallback={
123 <EmptyState123 <EmptyState
124 title={t("courses.noTeachers")}124 title={t("courses.noTeachers")}
125- description=""
126- action={
127- props.canStaff ? (
128- <Button size="sm" onClick={() => props.onAssignOpenChange(true)}>
129- <IconPlus class="mr-1.5 h-4 w-4" />
130- {t("courses.assignTeacher")}
131- </Button>
132- ) : undefined
133- }
134 />125 />
135 }126 }
136 >127 >
src/components/notes/note-list.tsxmodified+1 -3
@@ -1,4 +1,4 @@
1-import { For, Show, createSignal, type JSX } from "solid-js";1+import { For, Show, createSignal } from "solid-js";
2 import type { Note } from "@/api/client";2 import type { Note } from "@/api/client";
3 import { NoteCard } from "@/components/notes/note-card";3 import { NoteCard } from "@/components/notes/note-card";
4 import { NoteReaderPanel } from "@/components/notes/note-reader-panel";4 import { NoteReaderPanel } from "@/components/notes/note-reader-panel";
@@ -8,7 +8,6 @@ export function NoteList(props: {
8 notes: Note[];8 notes: Note[];
9 emptyTitle: string;9 emptyTitle: string;
10 emptyDescription?: string;10 emptyDescription?: string;
11- emptyAction?: JSX.Element;
12 onUpdate: (id: string, values: { title: string; content: string }) => Promise<void>;11 onUpdate: (id: string, values: { title: string; content: string }) => Promise<void>;
13 onDelete: (id: string) => Promise<void>;12 onDelete: (id: string) => Promise<void>;
14 }) {13 }) {
@@ -22,7 +21,6 @@ export function NoteList(props: {
22 <EmptyState21 <EmptyState
23 title={props.emptyTitle}22 title={props.emptyTitle}
24 description={props.emptyDescription}23 description={props.emptyDescription}
25- action={props.emptyAction}
26 />24 />
27 }25 }
28 >26 >
src/components/ui/combobox.tsxmodified+6 -6
@@ -14,8 +14,8 @@ export function ComboboxInput<T extends ValidComponent = "input">(
14 return (14 return (
15 <ComboboxPrimitive.Input15 <ComboboxPrimitive.Input
16 class={cn(16 class={cn(
17- "h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-sm outline-none transition-colors",17+ "flex h-11 w-full rounded-xl border border-border/80 bg-muted/30 px-3.5 py-2 text-sm text-foreground shadow-sm outline-none transition-all duration-150",
18- "placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",18+ "placeholder:text-muted-foreground hover:bg-muted/50 hover:border-border focus:bg-background focus-visible:ring-2 focus-visible:ring-primary/60 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
19 local.class,19 local.class,
20 )}20 )}
21 {...rest}21 {...rest}
@@ -34,8 +34,8 @@ export function ComboboxContent<T extends ValidComponent = "div">(
34 <ComboboxPrimitive.Portal>34 <ComboboxPrimitive.Portal>
35 <ComboboxPrimitive.Content35 <ComboboxPrimitive.Content
36 class={cn(36 class={cn(
37- "z-50 mt-1 max-h-72 min-w-[var(--kb-popper-anchor-width)] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none",37+ "z-50 mt-1.5 max-h-72 min-w-[var(--kb-popper-anchor-width)] overflow-hidden rounded-2xl border border-black/[0.08] dark:border-white/[0.12] bg-popover/95 backdrop-blur-xl p-1.5 text-popover-foreground shadow-apple outline-none",
38- "origin-[var(--kb-combobox-content-transform-origin)] animate-in fade-in-0 zoom-in-95",38+ "origin-[var(--kb-combobox-content-transform-origin)] animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
39 local.class,39 local.class,
40 )}40 )}
41 {...rest}41 {...rest}
@@ -53,8 +53,8 @@ export function ComboboxItem<T extends ValidComponent = "li">(
53 return (53 return (
54 <ComboboxPrimitive.Item54 <ComboboxPrimitive.Item
55 class={cn(55 class={cn(
56- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",56+ "relative flex min-h-[2.5rem] cursor-pointer select-none items-center rounded-xl px-3 py-2 text-sm font-medium outline-none transition-all duration-150",
57- "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",57+ "data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary active:scale-[0.98] data-[disabled]:pointer-events-none data-[disabled]:opacity-40",
58 local.class,58 local.class,
59 )}59 )}
60 {...rest}60 {...rest}
src/components/ui/dropdown-menu.tsxmodified+25 -25
@@ -21,9 +21,9 @@ export function DropdownMenuContent<T extends ValidComponent = "div">(
21 <DropdownMenuPrimitive.Portal>21 <DropdownMenuPrimitive.Portal>
22 <DropdownMenuPrimitive.Content22 <DropdownMenuPrimitive.Content
23 class={cn(23 class={cn(
24- "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none",24+ "z-50 min-w-[12rem] overflow-hidden rounded-2xl border border-black/[0.08] dark:border-white/[0.12] bg-popover/95 backdrop-blur-xl p-1.5 text-popover-foreground shadow-apple outline-none",
25 "origin-[var(--kb-menu-content-transform-origin)]",25 "origin-[var(--kb-menu-content-transform-origin)]",
26- "animate-in fade-in-0 zoom-in-95",26+ "animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
27 local.class,27 local.class,
28 )}28 )}
29 {...rest}29 {...rest}
@@ -42,10 +42,10 @@ export function DropdownMenuItem<T extends ValidComponent = "div">(
42 return (42 return (
43 <DropdownMenuPrimitive.Item43 <DropdownMenuPrimitive.Item
44 class={cn(44 class={cn(
45- "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",45+ "relative flex min-h-[2.5rem] cursor-pointer select-none items-center gap-2.5 rounded-xl px-3 py-2 text-sm font-medium outline-none transition-all duration-150",
46- "focus:bg-accent focus:text-accent-foreground data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",46+ "focus:bg-primary/10 focus:text-primary data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary active:scale-[0.98]",
47- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",47+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-40",
48- local.inset && "pl-8",48+ local.inset && "pl-9",
49 local.destructive &&49 local.destructive &&
50 "text-destructive focus:bg-destructive/10 focus:text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive",50 "text-destructive focus:bg-destructive/10 focus:text-destructive data-[highlighted]:bg-destructive/10 data-[highlighted]:text-destructive",
51 local.class,51 local.class,
@@ -62,16 +62,16 @@ export function DropdownMenuCheckboxItem<T extends ValidComponent = "div">(
62 return (62 return (
63 <DropdownMenuPrimitive.CheckboxItem63 <DropdownMenuPrimitive.CheckboxItem
64 class={cn(64 class={cn(
65- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",65+ "relative flex min-h-[2.5rem] cursor-pointer select-none items-center rounded-xl py-2 pl-9 pr-3 text-sm font-medium outline-none transition-all duration-150",
66- "focus:bg-accent focus:text-accent-foreground data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",66+ "focus:bg-primary/10 focus:text-primary data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary active:scale-[0.98]",
67- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",67+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-40",
68 local.class,68 local.class,
69 )}69 )}
70 {...rest}70 {...rest}
71 >71 >
72- <span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">72+ <span class="absolute left-2.5 flex h-4 w-4 items-center justify-center text-primary">
73 <DropdownMenuPrimitive.ItemIndicator>73 <DropdownMenuPrimitive.ItemIndicator>
74- <IconCheck class="h-3.5 w-3.5" />74+ <IconCheck class="h-4 w-4 stroke-[2.5]" />
75 </DropdownMenuPrimitive.ItemIndicator>75 </DropdownMenuPrimitive.ItemIndicator>
76 </span>76 </span>
77 {local.children}77 {local.children}
@@ -82,7 +82,7 @@ export function DropdownMenuCheckboxItem<T extends ValidComponent = "div">(
82 export function DropdownMenuLabel(props: ParentProps<{ class?: string }>) {82 export function DropdownMenuLabel(props: ParentProps<{ class?: string }>) {
83 return (83 return (
84 <DropdownMenuPrimitive.GroupLabel84 <DropdownMenuPrimitive.GroupLabel
85- class={cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", props.class)}85+ class={cn("px-3 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground/70", props.class)}
86 >86 >
87 {props.children}87 {props.children}
88 </DropdownMenuPrimitive.GroupLabel>88 </DropdownMenuPrimitive.GroupLabel>
@@ -90,7 +90,7 @@ export function DropdownMenuLabel(props: ParentProps<{ class?: string }>) {
90 }90 }
91 91
92 export function DropdownMenuSeparator(props: { class?: string }) {92 export function DropdownMenuSeparator(props: { class?: string }) {
93- return <DropdownMenuPrimitive.Separator class={cn("-mx-1 my-1 h-px bg-muted", props.class)} />;93+ return <DropdownMenuPrimitive.Separator class={cn("-mx-1 my-1.5 h-px bg-border/60", props.class)} />;
94 }94 }
95 95
96 export function DropdownMenuRadioItem<T extends ValidComponent = "div">(96 export function DropdownMenuRadioItem<T extends ValidComponent = "div">(
@@ -103,17 +103,17 @@ export function DropdownMenuRadioItem<T extends ValidComponent = "div">(
103 return (103 return (
104 <DropdownMenuPrimitive.RadioItem104 <DropdownMenuPrimitive.RadioItem
105 class={cn(105 class={cn(
106- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",106+ "relative flex min-h-[2.5rem] cursor-pointer select-none items-center rounded-xl py-2 pl-9 pr-3 text-sm font-medium outline-none transition-all duration-150",
107- "focus:bg-accent focus:text-accent-foreground data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",107+ "focus:bg-primary/10 focus:text-primary data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary active:scale-[0.98]",
108- "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",108+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-40",
109 local.class,109 local.class,
110 )}110 )}
111 {...rest}111 {...rest}
112 >112 >
113- <span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">113+ <span class="absolute left-2.5 flex h-4 w-4 items-center justify-center text-primary">
114 <DropdownMenuPrimitive.ItemIndicator>114 <DropdownMenuPrimitive.ItemIndicator>
115- <svg viewBox="0 0 8 8" class="h-2 w-2 fill-current" aria-hidden>115+ <svg viewBox="0 0 8 8" class="h-2.5 w-2.5 fill-current" aria-hidden>
116- <circle cx="4" cy="4" r="4" />116+ <circle cx="4" cy="4" r="3.5" />
117 </svg>117 </svg>
118 </DropdownMenuPrimitive.ItemIndicator>118 </DropdownMenuPrimitive.ItemIndicator>
119 </span>119 </span>
@@ -129,15 +129,15 @@ export function DropdownMenuSubTrigger<T extends ValidComponent = "div">(
129 return (129 return (
130 <DropdownMenuPrimitive.SubTrigger130 <DropdownMenuPrimitive.SubTrigger
131 class={cn(131 class={cn(
132- "flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",132+ "flex min-h-[2.5rem] w-full cursor-pointer select-none items-center gap-2.5 rounded-xl px-3 py-2 text-sm font-medium outline-none transition-all duration-150",
133- "focus:bg-accent data-[highlighted]:bg-accent data-[expanded]:bg-accent",133+ "focus:bg-primary/10 focus:text-primary data-[highlighted]:bg-primary/10 data-[highlighted]:text-primary data-[expanded]:bg-primary/10 data-[expanded]:text-primary",
134- local.inset && "pl-8",134+ local.inset && "pl-9",
135 local.class,135 local.class,
136 )}136 )}
137 {...rest}137 {...rest}
138 >138 >
139 {local.children}139 {local.children}
140- <IconChevronRight class="ml-1 h-4 w-4 shrink-0 opacity-50" />140+ <IconChevronRight class="ml-auto h-4 w-4 shrink-0 opacity-50" />
141 </DropdownMenuPrimitive.SubTrigger>141 </DropdownMenuPrimitive.SubTrigger>
142 );142 );
143 }143 }
@@ -152,9 +152,9 @@ export function DropdownMenuSubContent<T extends ValidComponent = "div">(
152 <DropdownMenuPrimitive.Portal>152 <DropdownMenuPrimitive.Portal>
153 <DropdownMenuPrimitive.SubContent153 <DropdownMenuPrimitive.SubContent
154 class={cn(154 class={cn(
155- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none",155+ "z-50 min-w-[9rem] overflow-hidden rounded-2xl border border-black/[0.08] dark:border-white/[0.12] bg-popover/95 backdrop-blur-xl p-1.5 text-popover-foreground shadow-apple outline-none",
156 "origin-[var(--kb-menu-content-transform-origin)]",156 "origin-[var(--kb-menu-content-transform-origin)]",
157- "animate-in fade-in-0 zoom-in-95",157+ "animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
158 local.class,158 local.class,
159 )}159 )}
160 {...rest}160 {...rest}
src/components/ui/empty-state.tsxmodified+4 -9
@@ -1,27 +1,22 @@
1-import type { JSX } from "solid-js";
2 import { Show } from "solid-js";1 import { Show } from "solid-js";
3 import { cn } from "@/lib/cn";2 import { cn } from "@/lib/cn";
4 3
5-/** Dashed empty panel with optional primary action. */4+/** Clean dashed empty panel. */
6 export function EmptyState(props: {5 export function EmptyState(props: {
7 title: string;6 title: string;
8 description?: string;7 description?: string;
9- action?: JSX.Element;
10 class?: string;8 class?: string;
11 }) {9 }) {
12 return (10 return (
13 <div11 <div
14 class={cn(12 class={cn(
15- "flex min-h-[12rem] flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border/80 bg-muted/20 px-6 py-10 text-center",13+ "flex min-h-[10rem] flex-col items-center justify-center gap-1.5 rounded-2xl border border-dashed border-border/70 bg-muted/20 px-6 py-8 text-center",
16 props.class,14 props.class,
17 )}15 )}
18 >16 >
19- <p class="text-sm font-medium text-foreground">{props.title}</p>17+ <p class="text-sm font-semibold text-foreground">{props.title}</p>
20 <Show when={props.description}>18 <Show when={props.description}>
21- <p class="max-w-sm text-sm leading-6 text-muted-foreground">{props.description}</p>19+ <p class="max-w-sm text-xs leading-relaxed text-muted-foreground">{props.description}</p>
22- </Show>
23- <Show when={props.action}>
24- <div class="pt-1">{props.action}</div>
25 </Show>20 </Show>
26 </div>21 </div>
27 );22 );
src/components/ui/popover.tsxmodified+2 -2
@@ -17,8 +17,8 @@ export function PopoverContent<T extends ValidComponent = "div">(
17 <PopoverPrimitive.Portal>17 <PopoverPrimitive.Portal>
18 <PopoverPrimitive.Content18 <PopoverPrimitive.Content
19 class={cn(19 class={cn(
20- "z-50 rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none",20+ "z-50 rounded-2xl border border-black/[0.08] dark:border-white/[0.12] bg-popover/95 backdrop-blur-xl p-2 text-popover-foreground shadow-apple outline-none",
21- "origin-[var(--kb-popover-content-transform-origin)] animate-in fade-in-0 zoom-in-95",21+ "origin-[var(--kb-popover-content-transform-origin)] animate-in fade-in-0 zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95",
22 local.class,22 local.class,
23 )}23 )}
24 {...rest}24 {...rest}
src/components/ui/select.tsxmodified+16 -7
@@ -8,12 +8,21 @@ export type SelectProps = ComponentProps<"select">;
8 export function Select(props: SelectProps) {8 export function Select(props: SelectProps) {
9 const [local, rest] = splitProps(props, ["class"]);9 const [local, rest] = splitProps(props, ["class"]);
10 return (10 return (
11- <select11+ <div class="relative w-full">
12- class={cn(12+ <select
13- "flex h-11 w-full rounded-xl border border-border/80 bg-muted/30 px-3.5 py-2 text-sm text-foreground transition-all duration-150 hover:bg-muted/50 hover:border-border focus:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>option]:bg-popover [&>option]:text-popover-foreground",13+ class={cn(
14- local.class,14+ "flex h-11 w-full appearance-none rounded-xl border border-border/80 bg-muted/30 pl-3.5 pr-9 py-2 text-sm font-medium text-foreground transition-all duration-150",
15- )}15+ "hover:bg-muted/50 hover:border-border focus:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 focus-visible:ring-offset-2",
16- {...rest}16+ "disabled:cursor-not-allowed disabled:opacity-50 [&>option]:bg-popover [&>option]:text-popover-foreground [&>option]:py-1.5",
17- />17+ local.class,
18+ )}
19+ {...rest}
20+ />
21+ <span class="pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground/70">
22+ <svg class="h-4 w-4 fill-none stroke-current stroke-2" viewBox="0 0 24 24">
23+ <path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
24+ </svg>
25+ </span>
26+ </div>
18 );27 );
19 }28 }
src/pages/course-detail-page.tsxmodified+0 -8
@@ -668,14 +668,6 @@ function CourseDetailContent() {
668 fallback={668 fallback={
669 <EmptyState669 <EmptyState
670 title={t("exams.emptyRoster")}670 title={t("exams.emptyRoster")}
671- action={
672- canManage() ? (
673- <Button type="button" size="sm" class="rounded-lg" onClick={() => setShowEnrollPanel(true)}>
674- <IconPlus class="h-4 w-4" />
675- {t("courses.enroll")}
676- </Button>
677- ) : undefined
678- }
679 />671 />
680 }672 }
681 >673 >
src/pages/notes-page.tsxmodified+0 -6
@@ -125,12 +125,6 @@ function NotesContent() {
125 notes={pageItems()}125 notes={pageItems()}
126 emptyTitle={t("dashboard.emptyNotesTitle")}126 emptyTitle={t("dashboard.emptyNotesTitle")}
127 emptyDescription={t("notes.empty")}127 emptyDescription={t("notes.empty")}
128- emptyAction={
129- <Button type="button" size="sm" class="rounded-lg" onClick={() => setCreateOpen(true)}>
130- <IconPlus class="h-4 w-4" />
131- {t("notes.new")}
132- </Button>
133- }
134 onUpdate={(id, values) =>128 onUpdate={(id, values) =>
135 wrap(async () => {129 wrap(async () => {
136 await patchNoteById(id, values);130 await patchNoteById(id, values);
src/pages/terms-page.tsxmodified+0 -6
@@ -196,12 +196,6 @@ function TermsContent() {
196 fallback={196 fallback={
197 <EmptyState197 <EmptyState
198 title={t("terms.empty")}198 title={t("terms.empty")}
199- action={
200- <Button type="button" size="sm" class="rounded-lg" onClick={openCreate}>
201- <IconPlus class="h-4 w-4" />
202- {t("terms.create")}
203- </Button>
204- }
205 />199 />
206 }200 }
207 >201 >