forge
Explore
Log in

Don't you dare go Hollow

♻️ extract detail page repetitive styles into shared CSS utilities

Browse files at this commit

31d0b976dd2dee68b450c9d474aad7fdfe92e92eBurak BoduroğluParent: 20c4fe6
  • refactor
    • ♻️ extract detail page repetitive styles into shared CSS utilities
Show full message
refactor: ♻️ extract detail page repetitive styles into shared CSS utilities
- detail-breadcrumb: reusable breadcrumb nav style
- detail-action-group: header action bar container
- detail-action-divider: responsive vertical/horizontal action divider
- detail-metric-card: detail page metric card container
src/index.cssmodified+20 -0
@@ -156,6 +156,26 @@
156 background-color: hsl(var(--muted) / 0.28);156 background-color: hsl(var(--muted) / 0.28);
157 }157 }
158 158
159+ .detail-breadcrumb {
160+ @apply flex flex-wrap items-center gap-1 text-xs text-muted-foreground;
161+ }
162+
163+ .detail-breadcrumb a {
164+ @apply transition-colors hover:text-foreground;
165+ }
166+
167+ .detail-action-group {
168+ @apply flex w-full flex-wrap items-center gap-1 rounded-lg border border-border bg-card p-1 shadow-sm sm:w-auto;
169+ }
170+
171+ .detail-action-divider {
172+ @apply flex flex-1 items-center gap-1 border-t border-border pt-1 sm:ml-1 sm:flex-none sm:border-l sm:border-t-0 sm:pl-1 sm:pt-0;
173+ }
174+
175+ .detail-metric-card {
176+ @apply rounded-lg border border-border bg-muted/25 p-3;
177+ }
178+
159 .side-panel-body form {179 .side-panel-body form {
160 @apply space-y-5 pb-5;180 @apply space-y-5 pb-5;
161 }181 }
src/pages/course-detail-page.tsxmodified+8 -8
@@ -163,10 +163,10 @@ function CourseDetailContent() {
163 <Show when={canViewCourse()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>163 <Show when={canViewCourse()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>
164 <div class="space-y-6">164 <div class="space-y-6">
165 <div class="space-y-2">165 <div class="space-y-2">
166- <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground">166+ <div class="detail-breadcrumb">
167 <span>{t("nav.group.classes")}</span>167 <span>{t("nav.group.classes")}</span>
168 <span>/</span>168 <span>/</span>
169- <Link to="/courses" class="hover:text-foreground">{t("courses.title")}</Link>169+ <Link to="/courses">{t("courses.title")}</Link>
170 <span>/</span>170 <span>/</span>
171 <span class="truncate">{c().title}</span>171 <span class="truncate">{c().title}</span>
172 </div>172 </div>
@@ -176,7 +176,7 @@ function CourseDetailContent() {
176 title={c().title}176 title={c().title}
177 description={c().description || undefined}177 description={c().description || undefined}
178 actions={178 actions={
179- <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-card p-1 shadow-sm sm:w-auto">179+ <div class="detail-action-group">
180 <Link to="/courses">180 <Link to="/courses">
181 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">181 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
182 <IconChevronLeft class="h-4 w-4" />182 <IconChevronLeft class="h-4 w-4" />
@@ -184,7 +184,7 @@ function CourseDetailContent() {
184 </Button>184 </Button>
185 </Link>185 </Link>
186 <Show when={canManage()}>186 <Show when={canManage()}>
187- <div class="flex flex-1 items-center gap-1 border-t border-border pt-1 sm:ml-1 sm:flex-none sm:border-l sm:border-t-0 sm:pl-1 sm:pt-0">187+ <div class="detail-action-divider">
188 <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={startEdit}>188 <Button type="button" variant="outline" size="sm" class="flex-1 rounded-sm sm:flex-none" onClick={startEdit}>
189 <IconEdit class="h-4 w-4" />189 <IconEdit class="h-4 w-4" />
190 {t("common.edit")}190 {t("common.edit")}
@@ -340,7 +340,7 @@ function CourseDetailContent() {
340 )}340 )}
341 341
342 <section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">342 <section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
343- <div class="data-shell p-4">343+ <div class="detail-metric-card">
344 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">344 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">
345 {t("courses.exams")}345 {t("courses.exams")}
346 </p>346 </p>
@@ -349,7 +349,7 @@ function CourseDetailContent() {
349 </div>349 </div>
350 350
351 <Show when={isTeacherPlus()}>351 <Show when={isTeacherPlus()}>
352- <div class="data-shell p-4">352+ <div class="detail-metric-card">
353 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">353 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">
354 {t("courses.roster")}354 {t("courses.roster")}
355 </p>355 </p>
@@ -358,7 +358,7 @@ function CourseDetailContent() {
358 </div>358 </div>
359 </Show>359 </Show>
360 360
361- <div class="data-shell p-4">361+ <div class="detail-metric-card">
362 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">362 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">
363 {t("exams.kind")}363 {t("exams.kind")}
364 </p>364 </p>
@@ -366,7 +366,7 @@ function CourseDetailContent() {
366 <p class="mt-1 text-xs text-muted-foreground">{t("courses.exams")}</p>366 <p class="mt-1 text-xs text-muted-foreground">{t("courses.exams")}</p>
367 </div>367 </div>
368 368
369- <div class="data-shell p-4">369+ <div class="detail-metric-card">
370 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">370 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">
371 {t("terms.term")}371 {t("terms.term")}
372 </p>372 </p>
src/pages/event-detail-page.tsxmodified+4 -4
@@ -93,10 +93,10 @@ function EventDetailContent() {
93 {(ev) => (93 {(ev) => (
94 <div class="space-y-6">94 <div class="space-y-6">
95 <div class="space-y-2">95 <div class="space-y-2">
96- <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground">96+ <div class="detail-breadcrumb">
97 <span>{t("nav.group.classes")}</span>97 <span>{t("nav.group.classes")}</span>
98 <span>/</span>98 <span>/</span>
99- <Link to="/events" class="hover:text-foreground">{t("events.title")}</Link>99+ <Link to="/events">{t("events.title")}</Link>
100 <span>/</span>100 <span>/</span>
101 <span class="truncate">{ev().title}</span>101 <span class="truncate">{ev().title}</span>
102 </div>102 </div>
@@ -106,7 +106,7 @@ function EventDetailContent() {
106 title={ev().title}106 title={ev().title}
107 description={`${formatDateTime(ev().starts_at, locale())} → ${formatDateTime(ev().ends_at, locale())}`}107 description={`${formatDateTime(ev().starts_at, locale())} → ${formatDateTime(ev().ends_at, locale())}`}
108 actions={108 actions={
109- <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-card p-1 shadow-sm sm:w-auto">109+ <div class="detail-action-group">
110 <Link to="/events">110 <Link to="/events">
111 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">111 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
112 <IconChevronLeft class="h-4 w-4" />112 <IconChevronLeft class="h-4 w-4" />
@@ -114,7 +114,7 @@ function EventDetailContent() {
114 </Button>114 </Button>
115 </Link>115 </Link>
116 <Show when={canManage()}>116 <Show when={canManage()}>
117- <div class="flex flex-1 items-center gap-1 border-t border-border pt-1 sm:ml-1 sm:flex-none sm:border-l sm:border-t-0 sm:pl-1 sm:pt-0">117+ <div class="detail-action-divider">
118 <Button118 <Button
119 type="button"119 type="button"
120 variant="outline"120 variant="outline"
src/pages/exam-detail-page.tsxmodified+12 -12
@@ -208,10 +208,10 @@ function ExamDetailContent() {
208 <Show when={canViewExam()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>208 <Show when={canViewExam()} fallback={<Alert variant="destructive">{t("common.accessDenied")}</Alert>}>
209 <div class="space-y-6">209 <div class="space-y-6">
210 <div class="space-y-2">210 <div class="space-y-2">
211- <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground">211+ <div class="detail-breadcrumb">
212 <span>{t("nav.group.classes")}</span>212 <span>{t("nav.group.classes")}</span>
213 <span>/</span>213 <span>/</span>
214- <Link to="/exams" class="hover:text-foreground">{t("exams.title")}</Link>214+ <Link to="/exams">{t("exams.title")}</Link>
215 <span>/</span>215 <span>/</span>
216 <span class="truncate">{ex().title}</span>216 <span class="truncate">{ex().title}</span>
217 </div>217 </div>
@@ -221,7 +221,7 @@ function ExamDetailContent() {
221 title={ex().title}221 title={ex().title}
222 description={ex().description || "—"}222 description={ex().description || "—"}
223 actions={223 actions={
224- <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-card p-1 shadow-sm sm:w-auto">224+ <div class="detail-action-group">
225 <Link to="/exams">225 <Link to="/exams">
226 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">226 <Button variant="ghost" size="sm" class="w-full rounded-sm sm:w-auto">
227 <IconChevronLeft class="h-4 w-4" />227 <IconChevronLeft class="h-4 w-4" />
@@ -245,7 +245,7 @@ function ExamDetailContent() {
245 </Link>245 </Link>
246 </Show>246 </Show>
247 <Show when={canManage()}>247 <Show when={canManage()}>
248- <div class="flex flex-1 items-center gap-1 border-t border-border pt-1 sm:ml-1 sm:flex-none sm:border-l sm:border-t-0 sm:pl-1 sm:pt-0">248+ <div class="detail-action-divider">
249 <Button249 <Button
250 type="button"250 type="button"
251 variant="outline"251 variant="outline"
@@ -341,19 +341,19 @@ function ExamDetailContent() {
341 description={t("exams.details")}341 description={t("exams.details")}
342 >342 >
343 <div class="grid gap-3 text-sm sm:grid-cols-2 lg:grid-cols-4">343 <div class="grid gap-3 text-sm sm:grid-cols-2 lg:grid-cols-4">
344- <div class="rounded-lg border bg-muted/25 p-3">344+ <div class="detail-metric-card">
345 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.mode")}</p>345 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.mode")}</p>
346 <p class="mt-1 font-medium">{examModeLabel(ex().mode)}</p>346 <p class="mt-1 font-medium">{examModeLabel(ex().mode)}</p>
347 </div>347 </div>
348- <div class="rounded-lg border bg-muted/25 p-3">348+ <div class="detail-metric-card">
349 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</p>349 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</p>
350 <p class="mono mt-1 font-medium">{formatDateTime(ex().starts_at, locale())}</p>350 <p class="mono mt-1 font-medium">{formatDateTime(ex().starts_at, locale())}</p>
351 </div>351 </div>
352- <div class="rounded-lg border bg-muted/25 p-3">352+ <div class="detail-metric-card">
353 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</p>353 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</p>
354 <p class="mono mt-1 font-medium">{formatDateTime(ex().ends_at, locale())}</p>354 <p class="mono mt-1 font-medium">{formatDateTime(ex().ends_at, locale())}</p>
355 </div>355 </div>
356- <div class="rounded-lg border bg-muted/25 p-3">356+ <div class="detail-metric-card">
357 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.durationMinutes")}</p>357 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.durationMinutes")}</p>
358 <p class="mono mt-1 font-medium">{formatDurationMinutes(examDurationMs(ex().duration_ms, ex().starts_at, ex().ends_at), locale())}</p>358 <p class="mono mt-1 font-medium">{formatDurationMinutes(examDurationMs(ex().duration_ms, ex().starts_at, ex().ends_at), locale())}</p>
359 </div>359 </div>
@@ -394,19 +394,19 @@ function ExamDetailContent() {
394 <Show when={stats()}>394 <Show when={stats()}>
395 {(s) => (395 {(s) => (
396 <div class="grid gap-3 text-sm sm:grid-cols-4">396 <div class="grid gap-3 text-sm sm:grid-cols-4">
397- <div class="rounded-lg border bg-muted/25 p-3">397+ <div class="detail-metric-card">
398 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.graded")}</p>398 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.graded")}</p>
399 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().graded}</p>399 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().graded}</p>
400 </div>400 </div>
401- <div class="rounded-lg border bg-muted/25 p-3">401+ <div class="detail-metric-card">
402 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.average")}</p>402 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.average")}</p>
403 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().average == null ? "—" : s().average}</p>403 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().average == null ? "—" : s().average}</p>
404 </div>404 </div>
405- <div class="rounded-lg border bg-muted/25 p-3">405+ <div class="detail-metric-card">
406 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.min")}</p>406 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.min")}</p>
407 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().min == null ? "—" : s().min}</p>407 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().min == null ? "—" : s().min}</p>
408 </div>408 </div>
409- <div class="rounded-lg border bg-muted/25 p-3">409+ <div class="detail-metric-card">
410 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.max")}</p>410 <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("exams.max")}</p>
411 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().max == null ? "—" : s().max}</p>411 <p class="mono mt-1 text-2xl font-semibold tabular-nums">{s().max == null ? "—" : s().max}</p>
412 </div>412 </div>