-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from emiliebunny/issue-2
Issue #2 [Frontend]: Calendar
- Loading branch information
Showing
5 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Schedule } from "@/types/Schedule"; | ||
|
||
const lanes = [ | ||
{ | ||
title: "Monday" | ||
}, | ||
{ | ||
title: "Tuesday" | ||
}, | ||
{ | ||
title: "Wednesday" | ||
}, | ||
{ | ||
title: "Thursday" | ||
}, | ||
{ | ||
title: "Friday" | ||
}, | ||
{ | ||
title: "Saturday" | ||
}, | ||
{ | ||
title: "Sunday" | ||
} | ||
] | ||
|
||
const TITLE_HEIGHT = 'h-[5rem]'; | ||
const TIMESLOT_HEIGHT = 'h-[6rem]' | ||
const LANE_HEIGHT = 'h-[145.5rem]' // must equal TIMESLOT_HEIGHT * 24 + 1.5 (this 1.5 used to adjust space of lane below the display text '24:00') | ||
|
||
type Props = { | ||
data: Schedule[]; | ||
}; | ||
|
||
export default function Calendar({ data }: Props) { | ||
return <div className="w-[1000px] flex flex-row space-x-[2px] px-2 rounded-lg bg-emerald-400"> | ||
<div className="basis-full flex flex-col items-end pr-2 pb-2"> | ||
<div className={`${TITLE_HEIGHT}`}></div> | ||
{ | ||
Array.from(Array(24).keys()).map(el => | ||
<div key={`timeslot-${el}`} className={`${TIMESLOT_HEIGHT}`}>{`${el.toString().padStart(2, "0")}`}:00</div> | ||
) | ||
} | ||
<div>24:00</div> | ||
</div> | ||
{ | ||
lanes.map(el => ( | ||
<div key={`cal-lane-${el.title}`} className="basis-full"> | ||
{/* <Lane title={el.title} active={el.title === 'Monday' ? false : true} /> */} | ||
<Lane title={el.title} active={true} /> | ||
</div> | ||
)) | ||
} | ||
</div>; | ||
} | ||
|
||
type LaneProps = { | ||
title: string; | ||
active: boolean; | ||
}; | ||
|
||
function Lane({ title, active }: LaneProps) { | ||
return <div className="flex flex-col"> | ||
<div className="h-20 text-lg flex items-center justify-center"> | ||
{title} | ||
</div> | ||
<div className={`${LANE_HEIGHT} w-full ${active ? 'bg-white' : 'bg-gray-300'}`}> | ||
|
||
</div> | ||
</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default function CalendarSlot() { | ||
return <> | ||
CalendarSlot | ||
</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as Calendar } from './Calendar'; | ||
export { default as CalendarSlot } from './CalendarSlot'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type Schedule = { | ||
title: string, | ||
start: string, | ||
end: string | ||
} |