Skip to content

Commit

Permalink
Merge pull request #16 from junction-asia-2023/feat/schedule-page
Browse files Browse the repository at this point in the history
feat(schedule): add schedule list page
  • Loading branch information
1ilsang committed Aug 19, 2023
2 parents baf5161 + 56ac648 commit b9f6321
Show file tree
Hide file tree
Showing 16 changed files with 372 additions and 1 deletion.
5 changes: 5 additions & 0 deletions public/svg/Arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions public/svg/Calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/svg/Clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/svg/Home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/svg/Plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/svg/Users.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/features/app/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SettingContainer from '../setting/Container';
import ErrorContainer from '../shared/error/Container';
import NotFound from '../shared/error/notfound/NotFound';
import PreviewContainer from '../preview/Container';
import ScheduleContainer from '../schedule/Container';
import EventContainer from '../event/Container';

const router = createRoutesFromElements(
Expand All @@ -28,6 +29,7 @@ const router = createRoutesFromElements(
<Route path="login" element={<LoginContainer />} />
<Route path="setting" element={<SettingContainer />} />
<Route path="preview" element={<PreviewContainer />} />
<Route path="schedule" element={<ScheduleContainer />} />
<Route path="event" element={<EventContainer />} />
<Route path="*" element={<NotFound />} />
</Route>,
Expand Down
35 changes: 35 additions & 0 deletions src/features/schedule/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useLayoutEffect } from 'react';
import { useAtom } from 'jotai';

import { titleAtom } from '../shared/layout/atom';

import MeetingItem from './components/MeetingItem';
import WeekSelector from './components/WeekSelector';
import './style/index.scss';
import useSchedule from './hooks/useSchedule';

const ScheduleContainer = () => {
const [, setTitle] = useAtom(titleAtom);
const { dummyMeetings, handleWeekChange } = useSchedule();

useLayoutEffect(() => {
setTitle({ title: 'Schedule', back: true });
}, []);

return (
<div className="schedule-container">
<WeekSelector onClick={handleWeekChange} />
{(dummyMeetings || []).map((x, key) => (
<MeetingItem key={key} {...x} />
))}
{/* <div className="button-area">
<button type="button">
<img src={plus} />
Add Schedule
</button>
</div> */}
</div>
);
};

export default ScheduleContainer;
7 changes: 7 additions & 0 deletions src/features/schedule/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { MeetingTypes } from '../type';

const Badge = ({ type }: { type: MeetingTypes }) => {
return <span className={`badge badge-${type}`}></span>;
};

export default Badge;
44 changes: 44 additions & 0 deletions src/features/schedule/components/MeetingItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Meeting } from '../type';

import calendar from '/svg/Calendar.svg';
import clock from '/svg/Clock.svg';
import home from '/svg/Home.svg';
import users from '/svg/Users.svg';
import arrow from '/svg/Arrow.svg';

import Badge from './Badge';

const MeetingItem = ({ type, title, date, time, place, people }: Meeting) => {
return (
<div className="meeting-item">
<h2>
<span>
<Badge type={type} />
{title.slice(0, 26)}
{title.length > 26 && '⋯'}
</span>
<img src={arrow} />
</h2>
<p>
<img src={calendar} />
{date}
</p>
<p>
<img src={clock} />
{time}
</p>
<p>
<img src={home} />
{place}
</p>
{people && (
<p>
<img src={users} />
{people}
</p>
)}
</div>
);
};

export default MeetingItem;
17 changes: 17 additions & 0 deletions src/features/schedule/components/WeekSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import calendar from '/svg/Calendar.svg';
import arrow from '/svg/Arrow.svg';

const WeekSelector = ({ onClick }: { onClick: () => void }) => {
return (
<div className="week-selector">
<img className="arrow arrow-left" src={arrow} onClick={onClick} />
<h1>
<img src={calendar} />
00.00&nbsp;&nbsp;~&nbsp;&nbsp;00.00
</h1>
<img className="arrow arrow-right" src={arrow} onClick={onClick} />
</div>
);
};

export default WeekSelector;
82 changes: 82 additions & 0 deletions src/features/schedule/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import { Meeting, MeetingTypes } from './type';

export const dummy: Array<Meeting> = [
{
type: MeetingTypes.Team,
title: 'Team Meeting Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Business,
title: 'Business Trip/Outside Work Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Personal,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
},
{
type: MeetingTypes.Team,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Business,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: 'Hall A',
people: 'Andreas',
},
{
type: MeetingTypes.Business,
title: 'Business Trip/Outside Work Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Personal,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Team,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Personal,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
people: 'Andreas and 14 others',
},
{
type: MeetingTypes.Personal,
title: 'Personal Schedule Title',
date: 'Wed, Aug 16th 2023',
time: '14:00 ~ 17:00',
place: '7F Conference Room A',
},
];
21 changes: 21 additions & 0 deletions src/features/schedule/hooks/useSchedule.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useState } from 'react';

import { dummy } from '../constants';
import { Meeting } from '../type';

const useSchedule = () => {
const [dummyMeetings, setDummyMeetings] = useState<Array<Meeting>>([
...dummy,
]);
const handleWeekChange = () => {
setDummyMeetings([
dummy[Math.floor(Math.random() * 10)],
dummy[Math.floor(Math.random() * 10)],
dummy[Math.floor(Math.random() * 10)],
dummy[Math.floor(Math.random() * 10)],
]);
};
return { dummyMeetings, handleWeekChange };
};

export default useSchedule;
116 changes: 116 additions & 0 deletions src/features/schedule/style/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
@import '../../shared/style/color';
@import '../../shared/style/variable';

.schedule-container {
width: 100%;
display: grid;
gap: 12px;
background-color: $background;
position: relative;

h1 {
color: #191919;
font-size: 16px;
font-weight: 500;
display: flex;
align-items: center;
}

h1 img {
width: 20px;
margin-right: 8px;
}

h2 {
color: #191919;
font-size: 16px;
font-weight: 700;
padding: 4px 0 6px;
display: flex;
align-items: center;
justify-content: space-between;
}

h2 img {
width: 16px;
}

.arrow {
padding: 0 24px;
}

.arrow-left {
transform: rotate(180deg);
}

p {
color: #000;
font-size: 14px;
font-weight: 400;
display: flex;
align-items: center;
}

p img {
margin-right: 8px;
width: 16px;
}

.meeting-item {
background-color: #ffffff;
padding: 8px 16px;
}

.badge {
width: 12px;
height: 12px;
border-radius: 6px;
display: inline-block;
margin-right: 8px;
}

.badge-team {
background-color: #ff0000;
}

.badge-business {
background-color: #24b277;
}

.badge-personal {
background-color: #0038ff;
}

.week-selector {
background-color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
padding: 6px 0;
}

.button-area {
border-top: 1px solid #e9e9f1;
padding: 16px;
background-color: #ffffff;
position: fixed;
bottom: 0;
width: calc($min-width - 32px);
}

button {
background-color: $button-background-color;
border: 1px solid $button-background-color;
color: $button-text-color;
font-weight: 500;
font-size: 16px;
padding: 6px 14px;
width: 100%;
height: 48px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
}
}
14 changes: 14 additions & 0 deletions src/features/schedule/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export enum MeetingTypes {
Team = 'team',
Business = 'business',
Personal = 'personal',
}

export type Meeting = {
type: MeetingTypes;
title: string;
date: string;
time: string;
place: string;
people?: string;
};
Loading

0 comments on commit b9f6321

Please sign in to comment.