Skip to content

Commit

Permalink
#17 add navigate & button active
Browse files Browse the repository at this point in the history
  • Loading branch information
eunbis committed Jul 24, 2022
1 parent db99c56 commit 3491e12
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/pages/Vote/VoteComplete/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable import/no-unresolved */
import React from 'react';
import { useNavigate } from 'react-router-dom';
import {
StyledRoot,
MainText,
Expand All @@ -11,14 +12,20 @@ import {
} from './style';

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

return (
<StyledRoot>
<MainText>ํˆฌํ‘œ๊ฐ€ ๋“ฑ๋ก๋˜์—ˆ์–ด์š”</MainText>
<ContentBox>
<Clothes>์˜ค๋Š˜ ์ฃผ๊ฒฝ๋ฐ”๋ง‰</Clothes>
<Place>์กฐํ˜•์˜ˆ์ˆ ๊ด€์—์„œ ํ—ˆ, ๋ถˆํ—ˆ?</Place>
</ContentBox>
<HomeButton>
<HomeButton
onClick={() => {
navigate('/');
}}
>
<Text>ํ™ˆ์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ</Text>
</HomeButton>
</StyledRoot>
Expand Down
32 changes: 30 additions & 2 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';
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { WhiteLeft } from 'assets';
import { HeaderIcon, PublicButton } from 'components';
Expand All @@ -20,6 +20,25 @@ import {

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

const [clothesText, setClothesText] = useState(true);

const changeHandler = () => {
setClothesText(false);
};

// const [content, setContent] = useState({
// clothes: '',
// place: '',
// });

// const onChangeContent = e => {
// setContent({
// ...content,
// [e.target.name]: e.target.value,
// });
// };

return (
<StyledRoot>
<HeaderIconBox>
Expand Down Expand Up @@ -51,6 +70,8 @@ function Vote() {
name="clothes"
placeholder="์ž…๊ณ ์‹ถ์€ ์˜ท์„ ์ ์–ด์ฃผ์„ธ์š”"
required="required"
// onChange={(changeHandler, onChangeContent)}
onChange={changeHandler}
/>
</Form>
</FormBox>
Expand All @@ -61,13 +82,20 @@ function Vote() {
type="text"
name="place"
placeholder="์˜ท์„ ์ž…๊ณ  ๊ฐˆ ์žฅ์†Œ๋ฅผ ์ ์–ด์ฃผ์„ธ์š”"
// onChange={onChangeContent}
/>
</Form>
</FormBox>
<SubjectText>ํ—ˆ, ๋ถˆํ—ˆ?</SubjectText>
</ContentBox>
<ButtonBox>
<PublicButton text="ํˆฌํ‘œ ๋งŒ๋“ค๊ธฐ" />
<PublicButton
onClick={() => {
navigate('/votecomplete');
}}
text="ํˆฌํ‘œ ๋งŒ๋“ค๊ธฐ"
isDisabled={clothesText}
/>
</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 3491e12

Please sign in to comment.