Skip to content

Commit

Permalink
Merge pull request #25 from EFUB-TEAM4/issue-17
Browse files Browse the repository at this point in the history
#17 [Vote] Button & VoteComplete Params
  • Loading branch information
JangAyeon authored Jul 27, 2022
2 parents 25467b9 + 9771892 commit 8ca1a5e
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ function AppRouter() {
<Route path="/save" element={<Save />} />
<Route path="/savecomplete" element={<SaveComplete />} />
<Route path="/vote" element={<Vote />} />
<Route path="/votecomplete" element={<VoteComplete />} />
<Route
path="/votecomplete/:clothes/:place"
element={<VoteComplete />}
/>
<Route path="/mypage" element={<MyPage />} />
<Route path="/mypage/save/:date" element={<SaveRecord />} />
<Route path="/" element={<Main />} />
Expand Down
20 changes: 17 additions & 3 deletions src/pages/Vote/VoteComplete/index.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import {
StyledRoot,
MainText,
ContentBox,
Clothes,
Place,
Params,
HomeButton,
Text,
} from './style';

function VoteComplete() {
const navigate = useNavigate();
const { clothes } = useParams();
const { place } = useParams();

return (
<StyledRoot>
<MainText>ํˆฌํ‘œ๊ฐ€ ๋“ฑ๋ก๋˜์—ˆ์–ด์š”</MainText>
<ContentBox>
<Clothes>์˜ค๋Š˜ ์ฃผ๊ฒฝ๋ฐ”๋ง‰</Clothes>
<Place>์กฐํ˜•์˜ˆ์ˆ ๊ด€์—์„œ ํ—ˆ, ๋ถˆํ—ˆ?</Place>
<Clothes>
์˜ค๋Š˜ <Params>{clothes}</Params>
</Clothes>
<Place>
<Params>{place}</Params>์—์„œ ํ—ˆ, ๋ถˆํ—ˆ?
</Place>
</ContentBox>
<HomeButton>
<HomeButton
onClick={() => {
navigate('/');
}}
>
<Text>ํ™ˆ์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ</Text>
</HomeButton>
</StyledRoot>
Expand Down
19 changes: 18 additions & 1 deletion src/pages/Vote/VoteComplete/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ const Place = styled.p`
}
`;

const Params = styled.b`
font-weight: ${({ theme: { font } }) => font.weight.bold};
${applyMediaQuery('mobile')} {
font-weight: ${({ theme: { font } }) => font.weight.bold};
}
`;

const HomeButton = styled.button`
width: 20rem;
height: 5rem;
Expand All @@ -83,4 +91,13 @@ const Text = styled.p`
}
`;

export { StyledRoot, MainText, ContentBox, Clothes, Place, HomeButton, Text };
export {
StyledRoot,
MainText,
ContentBox,
Clothes,
Place,
Params,
HomeButton,
Text,
};
34 changes: 30 additions & 4 deletions src/pages/Vote/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
/* eslint-disable */
import React, { useState, useParams } from 'react';
import { useNavigate } from 'react-router-dom';
import { WhiteLeft } from 'assets';
import { HeaderIcon, PublicButton } from 'components';
Expand All @@ -20,6 +20,22 @@ import {

function Vote() {
const navigate = useNavigate();

const [clothes, setClothes] = useState('');
const [place, setPlace] = useState('');

const cChangeHandler = e => {
setClothes(e.target.value);
};

const pChangeHandler = e => {
setPlace(e.target.value);
};

const handleSubmit = e => {
e.preventDefault();
};

return (
<StyledRoot>
<HeaderIconBox>
Expand All @@ -45,12 +61,14 @@ function Vote() {
<SubjectText>
์˜ค๋Š˜ ์ด ์˜ท<span>*</span>
</SubjectText>
<Form>
<Form onSubmit={handleSubmit}>
<input
type="text"
name="clothes"
placeholder="์ž…๊ณ ์‹ถ์€ ์˜ท์„ ์ ์–ด์ฃผ์„ธ์š”"
required="required"
value={clothes}
onChange={cChangeHandler}
/>
</Form>
</FormBox>
Expand All @@ -61,13 +79,21 @@ function Vote() {
type="text"
name="place"
placeholder="์˜ท์„ ์ž…๊ณ  ๊ฐˆ ์žฅ์†Œ๋ฅผ ์ ์–ด์ฃผ์„ธ์š”"
value={place}
onChange={pChangeHandler}
/>
</Form>
</FormBox>
<SubjectText>ํ—ˆ, ๋ถˆํ—ˆ?</SubjectText>
</ContentBox>
<ButtonBox>
<PublicButton text="ํˆฌํ‘œ ๋งŒ๋“ค๊ธฐ" />
<PublicButton
onClick={() => {
navigate(`/votecomplete/${clothes}/${place}`);
}}
text="ํˆฌํ‘œ ๋งŒ๋“ค๊ธฐ"
isDisabled={clothes.length > 0 ? 0 : 1}
/>
</ButtonBox>
</StyledRoot>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Vote/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const BackButton = styled.img`
height: 3rem;
`;

const Text = styled.p`
const Text = styled.div`
width: 100%;
display: flex;
flex-direction: column;
Expand Down

0 comments on commit 8ca1a5e

Please sign in to comment.