Skip to content

Commit

Permalink
Merge pull request #11 from EFUB-TEAM4/issue-5
Browse files Browse the repository at this point in the history
#5 : [Save] PC, Mobile UI
  • Loading branch information
JangAyeon authored Jul 18, 2022
2 parents 2c3c4a9 + f88d221 commit 53bcd19
Show file tree
Hide file tree
Showing 17 changed files with 743 additions and 22 deletions.
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"moment": "^2.29.4",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-calendar": "^3.7.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.2",
"react-router-dom": "^6.3.0",
Expand Down
3 changes: 2 additions & 1 deletion src/AppRouter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { Login, Main, Save, Vote, MyPage } from 'pages';
import { Login, Main, Save, Vote, MyPage, SaveRecord } from 'pages';

function AppRouter() {
return (
Expand All @@ -16,6 +16,7 @@ function AppRouter() {
<Route path="/save" element={<Save />} />
<Route path="/vote" element={<Vote />} />
<Route path="/mypage" element={<MyPage />} />
<Route path="/mypage/save/:date" element={<SaveRecord />} />
<Route path="/" element={<Main />} />
</Routes>
</BrowserRouter>
Expand Down
3 changes: 3 additions & 0 deletions src/assets/Arrow/WhiteLeft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/assets/Tmp/SaveBear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/assets/Tmp/WeatherInfo.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 src/assets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export { default as BoxLeft } from './Arrow/BoxLeft.svg';
export { default as BoxRight } from './Arrow/BoxRight.svg';
export { default as NormalLeft } from './Arrow/NormalLeft.svg';
export { default as NormalRight } from './Arrow/NormalRight.svg';
export { default as WhiteLeft } from './Arrow/WhiteLeft.svg';
/* Weather / Calender */
export { default as CalCloud } from './Weather/Calender/Cloud.svg';
export { default as CalDoubleCloud } from './Weather/Calender/DoubleCloud.svg';
Expand Down Expand Up @@ -72,3 +73,6 @@ export { default as TSunCloud } from './Weather/Time/SunCloud.svg';
export { default as LoginBear } from './Bear/LoginBear.svg';
/* Login Button Google Logo */
export { default as GoogleBtn } from './Icon/Google.svg';
/* Save Page tmp icon - Bear / WeatherInfo */
export { default as SaveBear } from './Tmp/SaveBear.svg';
export { default as WeatherInfo } from './Tmp/WeatherInfo.svg';
60 changes: 60 additions & 0 deletions src/components/CustomCalendar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* eslint-disable import/no-unresolved */
import React, { useState } from 'react';
import { NavLink } from 'react-router-dom';
import Calendar from 'react-calendar';
import moment from 'moment';
import { CalMoonCloud } from 'assets';
import { StyledRoot, CalendarContainer, Image } from './style';

function CustomCalendar() {
const [value, onChange] = useState(new Date());
const mark = ['2022-07-07', '2022-07-10'];
return (
<StyledRoot>
<CalendarContainer>
<Calendar
onChange={onChange}
value={value}
formatDay={(
view, // eslint-disable-line no-unused-vars
date,
) => date.toLocaleString('en', { day: 'numeric' })}
showNeighboringMonth={false}
next2Label={null}
prev2Label={null}
tileClassName={({ date }) => {
if (mark.find(x => x === moment(date).format('YYYY-MM-DD'))) {
return 'highlight';
}
return null;
}}
/* eslint-disable */
tileContent={({ date, view }) => {
const html = [];
if (mark.find(x => x === moment(date).format('YYYY-MM-DD'))) {
html.push(
<NavLink key={0} to={`/MyPage/save/${date}`}>
<Image src={CalMoonCloud} alt="record" />
</NavLink>,
);
}
return (
<div
style={{
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: '40px',
}}
>
{html}
</div>
);
}}
/>
</CalendarContainer>
</StyledRoot>
);
}

export default CustomCalendar;
86 changes: 86 additions & 0 deletions src/components/CustomCalendar/style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* eslint-disable import/no-unresolved */
import styled from 'styled-components';
import { applyMediaQuery } from 'styles/mediaQuery';

const StyledRoot = styled.div`
background-color: ${({ theme: { color } }) => color.greenDarker};
`;

const CalendarContainer = styled.div`
width: 70vw;
${applyMediaQuery('mobile')} {
width: 80vw;
}
margin: auto;
padding: 0 3rem;
${applyMediaQuery('mobile')} {
padding: 0 1rem;
}
border-radius: 1rem;
background-color: ${({ theme: { color } }) => color.white};
.react-calendar__navigation {
display: flex;
.react-calendar__navigation__label {
font-family: 'Cafe24Ssurround';
font-size: ${({ theme: { font } }) => font.size.small};
font-weight: ${({ theme: { font } }) => font.weight.bold};
color: ${({ theme: { color } }) => color.greenDarker};
}
.react-calendar__navigation__arrow {
flex-grow: 0.01;
color: ${({ theme: { color } }) => color.greenDarker};
font-size: ${({ theme: { font } }) => font.size.medium};
}
}
.react-calendar__month-view__weekdays {
padding: 1rem 0;
border-radius: 1rem;
text-align: center;
background-color: ${({ theme: { color } }) => color.greenLightest};
color: ${({ theme: { color } }) => color.greyDarkest};
font-family: 'Noto Sans';
font-size: ${({ theme: { font } }) => font.size.micro};
font-weight: ${({ theme: { font } }) => font.weight.bold};
}
.react-calendar__month-view__weekdays__weekday abbr {
font-family: 'Noto Sans';
text-decoration: none;
}
.react-calendar__month-view__days__day abbr {
font-family: 'Noto Sans';
}
.react-calendar__tile--now {
font-family: 'Noto Sans';
color: ${({ theme: { color } }) => color.greenDarker};
}
.react-calendar__tile--active abbr {
font-family: 'Noto Sans';
background-color: ${({ theme: { color } }) => color.greenDarker};
color: ${({ theme: { color } }) => color.greenLightest};
border-radius: 50%;
display: inline-block;
width: 2rem;
height: 2rem;
line-height: 2rem;
text-align: center;
}
button {
background-color: ${({ theme: { color } }) => color.white};
height: 7rem;
border: 0;
}
`;

const Image = styled.img`
width: 2.5rem;
height: 2.5rem;
`;

const Text = styled.p`
color: ${({ theme: { color } }) => color.white};
font-family: 'Noto Sans';
font-size: ${({ theme: { font } }) => font.size.micro};
font-weight: ${({ theme: { font } }) => font.weight.bold};
`;

export { StyledRoot, CalendarContainer, Image, Text };
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* ์ปดํฌ๋„ŒํŠธ export ํŒŒ์ผ */
export { default as HeaderIcon } from './Common/HeaderIcon';
export { default as PublicButton } from './Common/PublicButton';
export { default as CustomCalendar } from './CustomCalendar';
46 changes: 41 additions & 5 deletions src/pages/MyPage/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { HeaderIcon, PublicButton } from 'components';
import { StyledRoot, Text } from './style';
import { useNavigate } from 'react-router-dom';
import { CustomCalendar } from 'components';
import { User, WhiteLeft } from 'assets';
import {
StyledRoot,
DesktopHeader,
LogoutButton,
MobileHeader,
BackButton,
UserWrapper,
UserTextWrapper,
UserIcon,
NameText,
EmailText,
MobileFooter,
} from './style';

function MyPage() {
const navigate = useNavigate();
return (
<StyledRoot>
<HeaderIcon />
<Text>MyPage</Text>
<PublicButton text="ํˆฌํ‘œ ๋งŒ๋“ค๊ธฐ" onClick={() => {}} isDisabled={0} />
<DesktopHeader>
<LogoutButton>๋กœ๊ทธ์•„์›ƒ</LogoutButton>
</DesktopHeader>
<MobileHeader>
<button
type="button"
onClick={() => {
navigate(-1);
}}
>
<BackButton src={WhiteLeft} alt="BackButton" />
</button>
</MobileHeader>
<UserWrapper>
<UserIcon src={User} alt="UserIcon" />
<UserTextWrapper>
<NameText>์ด๋ฆ„</NameText>
<EmailText>์ด๋ฉ”์ผ</EmailText>
</UserTextWrapper>
</UserWrapper>
<CustomCalendar />
<MobileFooter>
<LogoutButton>๋กœ๊ทธ์•„์›ƒ</LogoutButton>
</MobileFooter>
</StyledRoot>
);
}
Expand Down
Loading

0 comments on commit 53bcd19

Please sign in to comment.