Skip to content

Commit

Permalink
tweaked styling
Browse files Browse the repository at this point in the history
  • Loading branch information
amykapernick committed Jun 28, 2024
1 parent 239f3d4 commit f97c2c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/components/schedule/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,23 @@ import Appointment from "./appointment";
import { CSSProperties } from "react";

type ScheduleProps = {
type: "guest" | "vendor";
events: RunsheetEvent[];
startDate: Date;
endDate: Date;
guests: Record<string, { id: string; name: string }>;
};

const Schedule = (props: ScheduleProps) => {
const { events, startDate, endDate, guests } = props;
const { events, startDate, endDate, guests, type } = props;
const guestIndex: { id: string; name: string }[] = Object.values(guests).map((guest, i) => ({
...guest,
index: i,
}));
const days = differenceInCalendarDays(endDate, startDate) !== 1 ? differenceInCalendarDays(endDate, startDate) + 1 : differenceInCalendarDays(endDate, startDate);

return (
<div className={styles.schedule} style={{ "--days": days } as CSSProperties}>
<div className={styles.schedule} style={{ "--days": days } as CSSProperties} data-type={type}>
<Scheduler
data={
events.map((event) => ({
Expand Down
18 changes: 15 additions & 3 deletions src/components/schedule/style.module.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
.schedule {
text-transform: none;
max-width: 100%;
overflow-x: auto;
margin: 0 auto;

&:not([data-type="vendor"]) {
max-width: min(100%, calc(250px * var(--days) + 100px));
}
&[data-type="vendor"] {
max-width: min(100%, 1200px);
}

& > * {
min-width: calc((150px * var(--days)) + 100px);
}
}

.appointment.appointment {
.appointment.appointment.appointment {
position: relative;
text-overflow: ellipsis;
background: $green;
background-color: $green;
color: $white;
font-family: $font_main;

Expand All @@ -26,6 +33,11 @@
& .guest {
font-style: italic;
}

&:hover {
background-color: $green_light;
color: $neutral;
}
}

.dialog {
Expand Down
2 changes: 0 additions & 2 deletions src/styles/global/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

@import './clerk';

@import './schedule';

*, *::before, *::after {
box-sizing: border-box;
outline-offset: 0.2em;
Expand Down
Empty file removed src/styles/global/schedule.css
Empty file.
3 changes: 2 additions & 1 deletion utils/formatSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ const formatSchedule = (props: formatRunsheetProps) =>
events: formattedEvents,
startDate,
endDate,
guests
guests,
type
}
}

Expand Down

0 comments on commit f97c2c8

Please sign in to comment.