Skip to content

Commit 9c6e82c

Browse files
feat(condensed): add condensed view support for ScheduleCalendar
- 7 data-slots: schedule-calendar, schedule-calendar-header, schedule-calendar-grid, schedule-calendar-day-headers, schedule-calendar-time-labels, schedule-calendar-appointment, schedule-calendar-legend - Condensed CSS: compact header (0.5rem padding, 1.75rem buttons), narrower time labels (2.75rem), shorter hour rows (2.5rem), smaller appointment text, compact legend - Switch className to cn() utility for safe undefined handling
1 parent fca5603 commit 9c6e82c

2 files changed

Lines changed: 104 additions & 7 deletions

File tree

src/components/ScheduleCalendar/ScheduleCalendar.tsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22

33
import * as React from 'react';
4+
import { cn } from '../../utils/cn';
45
import { Button } from '../Button/Button';
56

67
export interface CalendarAppointment {
@@ -155,7 +156,11 @@ export function ScheduleCalendar({
155156
if (isLoading) {
156157
return (
157158
<div
158-
className={`rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900 ${className}`}
159+
data-slot="schedule-calendar"
160+
className={cn(
161+
'rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900',
162+
className
163+
)}
159164
>
160165
<div className="h-12 animate-pulse rounded-t-lg bg-gray-200 dark:bg-gray-700" />
161166
<div className="space-y-2 p-4">
@@ -174,10 +179,17 @@ export function ScheduleCalendar({
174179

175180
return (
176181
<div
177-
className={`rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900 ${className}`}
182+
data-slot="schedule-calendar"
183+
className={cn(
184+
'rounded-lg border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900',
185+
className
186+
)}
178187
>
179188
{/* Header */}
180-
<div className="flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700">
189+
<div
190+
data-slot="schedule-calendar-header"
191+
className="flex items-center justify-between border-b border-gray-200 p-4 dark:border-gray-700"
192+
>
181193
<div className="flex items-center gap-2">
182194
<Button
183195
variant="outline"
@@ -243,11 +255,14 @@ export function ScheduleCalendar({
243255
</div>
244256

245257
{/* Calendar Grid */}
246-
<div className="overflow-auto">
258+
<div data-slot="schedule-calendar-grid" className="overflow-auto">
247259
<div className="min-w-[600px]">
248260
{/* Day Headers for Week View */}
249261
{view === 'week' && (
250-
<div className="flex border-b border-gray-200 dark:border-gray-700">
262+
<div
263+
data-slot="schedule-calendar-day-headers"
264+
className="flex border-b border-gray-200 dark:border-gray-700"
265+
>
251266
<div className="w-16 flex-shrink-0" />
252267
{weekDates.map((date, i) => (
253268
<div
@@ -278,7 +293,10 @@ export function ScheduleCalendar({
278293
{/* Time Grid */}
279294
<div className="flex">
280295
{/* Time Labels */}
281-
<div className="w-16 flex-shrink-0">
296+
<div
297+
data-slot="schedule-calendar-time-labels"
298+
className="w-16 flex-shrink-0"
299+
>
282300
{hours.map((hour) => (
283301
<div
284302
key={hour}
@@ -335,6 +353,7 @@ export function ScheduleCalendar({
335353
return (
336354
<div
337355
key={appointment.id}
356+
data-slot="schedule-calendar-appointment"
338357
role="button"
339358
tabIndex={0}
340359
className={`absolute right-1 left-1 cursor-pointer overflow-hidden rounded border-l-4 px-2 py-1 text-xs text-white ${getStatusColor(appointment.status)}`}
@@ -365,7 +384,10 @@ export function ScheduleCalendar({
365384
</div>
366385

367386
{/* Legend */}
368-
<div className="flex items-center gap-4 border-t border-gray-200 p-4 text-xs dark:border-gray-700">
387+
<div
388+
data-slot="schedule-calendar-legend"
389+
className="flex items-center gap-4 border-t border-gray-200 p-4 text-xs dark:border-gray-700"
390+
>
369391
<div className="flex items-center gap-1">
370392
<span className="h-3 w-3 rounded bg-blue-700" />
371393
<span className="text-gray-600 dark:text-gray-400">Confirmed</span>

src/styles/condensed-view.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11188,3 +11188,78 @@ body.condensed [data-slot='report-dashboard-employers'] .h-2 {
1118811188
height: 0.25rem !important;
1118911189
margin-top: 0.125rem !important;
1119011190
}
11191+
11192+
/* ==========================================================================
11193+
ScheduleCalendar
11194+
========================================================================== */
11195+
11196+
/* Root — tighter border radius */
11197+
body.condensed [data-slot='schedule-calendar'] {
11198+
border-radius: 0.375rem !important;
11199+
}
11200+
11201+
/* Header — compact padding, smaller title */
11202+
body.condensed [data-slot='schedule-calendar-header'] {
11203+
padding: 0.5rem 0.75rem !important;
11204+
}
11205+
11206+
body.condensed [data-slot='schedule-calendar-header'] h2 {
11207+
font-size: 0.875rem !important;
11208+
}
11209+
11210+
body.condensed [data-slot='schedule-calendar-header'] [data-slot='button'] {
11211+
height: 1.75rem !important;
11212+
padding: 0 0.5rem !important;
11213+
font-size: 0.75rem !important;
11214+
}
11215+
11216+
/* Day headers (week view) — smaller text, tighter padding */
11217+
body.condensed [data-slot='schedule-calendar-day-headers'] > div {
11218+
padding: 0.25rem !important;
11219+
}
11220+
11221+
body.condensed [data-slot='schedule-calendar-day-headers'] p.text-xs {
11222+
font-size: 0.625rem !important;
11223+
}
11224+
11225+
body.condensed [data-slot='schedule-calendar-day-headers'] p.text-lg {
11226+
font-size: 0.875rem !important;
11227+
}
11228+
11229+
/* Time labels — narrower column, smaller text */
11230+
body.condensed [data-slot='schedule-calendar-time-labels'] {
11231+
width: 2.75rem !important;
11232+
}
11233+
11234+
body.condensed [data-slot='schedule-calendar-time-labels'] > div {
11235+
height: 2.5rem !important;
11236+
font-size: 0.625rem !important;
11237+
}
11238+
11239+
/* Time grid — shorter hour rows */
11240+
body.condensed [data-slot='schedule-calendar-grid'] .h-16 {
11241+
height: 2.5rem !important;
11242+
}
11243+
11244+
/* Appointments — smaller text, tighter padding */
11245+
body.condensed [data-slot='schedule-calendar-appointment'] {
11246+
padding: 0.125rem 0.375rem !important;
11247+
font-size: 0.625rem !important;
11248+
border-left-width: 3px !important;
11249+
}
11250+
11251+
body.condensed [data-slot='schedule-calendar-appointment'] p {
11252+
line-height: 1.2 !important;
11253+
}
11254+
11255+
/* Legend — compact padding, smaller badges */
11256+
body.condensed [data-slot='schedule-calendar-legend'] {
11257+
padding: 0.375rem 0.75rem !important;
11258+
gap: 0.5rem !important;
11259+
font-size: 0.625rem !important;
11260+
}
11261+
11262+
body.condensed [data-slot='schedule-calendar-legend'] span.h-3 {
11263+
height: 0.5rem !important;
11264+
width: 0.5rem !important;
11265+
}

0 commit comments

Comments
 (0)