이준호

[UPDATE] 메인 Page 배경화면 디자인 변경 및 버튼 커스텀

...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
10 "antd": "^4.8.2", 10 "antd": "^4.8.2",
11 "axios": "^0.21.0", 11 "axios": "^0.21.0",
12 "node-sass": "4", 12 "node-sass": "4",
13 + "polished": "^4.0.5",
13 "react": "^17.0.1", 14 "react": "^17.0.1",
14 "react-dom": "^17.0.1", 15 "react-dom": "^17.0.1",
15 "react-redux": "^7.2.2", 16 "react-redux": "^7.2.2",
......
1 import React from "react"; 1 import React from "react";
2 import styled, { css } from "styled-components"; 2 import styled, { css } from "styled-components";
3 +import { lighten,darken } from "polished";
3 4
4 function Card({ question, answer, setAnswer, curIdx, setCurIdx }) { 5 function Card({ question, answer, setAnswer, curIdx, setCurIdx }) {
5 const CardWrap = styled.div` 6 const CardWrap = styled.div`
...@@ -30,6 +31,12 @@ function Card({ question, answer, setAnswer, curIdx, setCurIdx }) { ...@@ -30,6 +31,12 @@ function Card({ question, answer, setAnswer, curIdx, setCurIdx }) {
30 display: flex; 31 display: flex;
31 justify-content: center; 32 justify-content: center;
32 align-items: center; 33 align-items: center;
34 + &:hover {
35 + background: ${lighten(0.1, "#536349")}; // color of card -> theme화 하기
36 + }
37 + &:active {
38 + background: ${darken(0.1, "#536349")};
39 + }
33 `; 40 `;
34 41
35 const onClickOne = () => { 42 const onClickOne = () => {
......
1 -import React,{useEffect} from 'react'; 1 +import React, { useEffect } from "react";
2 -import {getQuestionThunk} from '../store/action/survey'; 2 +import { getQuestionThunk } from "../store/action/survey";
3 -import { useDispatch } from 'react-redux'; 3 +import { useDispatch } from "react-redux";
4 -import {Button} from "antd"; 4 +import soldier from '../assets/soldier.png';
5 -import mainImg from "../assets/main-soldier.png"; 5 +import styled from "styled-components";
6 -import styled from 'styled-components'; 6 +import pattern from '../assets/mainPattern.jpeg';
7 +
8 +const Wrapper = styled.div`
9 + width: 100%;
10 + height: 100vh;
11 + background-image: url(${pattern});
12 + background-repeat: no-repeat; // background-image가 컨테이너를 가득 채우지 못할 경우에도 반복하지 않는다.
13 + background-size: cover; // 사이즈가 container에 맞지 않아도 꽉 차도록 채운다.
14 + background-position: center; // background-image가 컨테이너에 가운데로 오도록 한다.
15 +`;
7 16
8 const Container = styled.div` 17 const Container = styled.div`
9 - display:flex; 18 + display: flex;
10 flex-direction: column; 19 flex-direction: column;
11 align-items: center; 20 align-items: center;
21 + justify-content: center;
22 + color: #ffffff;
12 `; 23 `;
13 24
14 const MainImg = styled.img` 25 const MainImg = styled.img`
15 - margin-top: 2rem; 26 + height: 50vh;
16 - width: 70rem;
17 - height: 35rem;
18 - border-radius: 1rem;
19 `; 27 `;
20 28
21 const MainTitle = styled.div` 29 const MainTitle = styled.div`
...@@ -31,33 +39,48 @@ const MainDesc = styled.div` ...@@ -31,33 +39,48 @@ const MainDesc = styled.div`
31 font-size: 1.5rem; 39 font-size: 1.5rem;
32 `; 40 `;
33 41
42 +const MainBtn = styled.div`
43 + cursor: pointer;
44 + display: flex;
45 + justify-content: center;
46 + align-items: center;
47 + margin-top: 1rem;
48 + width: 25rem;
49 + height: 5rem;
50 + font-size: 1.6rem;
51 + font-weight: bold;
52 + border-radius: 1rem;
53 + border: 1px solid #010101;
54 + background-color: #3c441d;
55 + &:hover{
56 + background-color: #ffffff;
57 + color: #010101;
58 + }
59 +`;
34 60
35 -function MainPage({history}){ 61 +function MainPage({ history }) {
36 const dispatch = useDispatch(); 62 const dispatch = useDispatch();
37 const onClick = () => { 63 const onClick = () => {
38 - history.push('/survey'); 64 + history.push("/survey");
39 - } 65 + };
40 66
41 - useEffect(()=>{ 67 + useEffect(() => {
42 dispatch(getQuestionThunk()); 68 dispatch(getQuestionThunk());
43 - },[]); 69 + }, []);
44 70
45 - return( 71 + return (
46 <> 72 <>
73 + <Wrapper>
47 <Container> 74 <Container>
48 <MainTitle>KHUSAT</MainTitle> 75 <MainTitle>KHUSAT</MainTitle>
49 <MainDesc> 76 <MainDesc>
50 KHUSAT 특별과정, <br></br> 77 KHUSAT 특별과정, <br></br>
51 여러분의 보직을 추천드립니다. 78 여러분의 보직을 추천드립니다.
52 </MainDesc> 79 </MainDesc>
53 - <Button 80 + <MainImg src={soldier} />
54 - size="large" 81 + <MainBtn onClick={onClick}>시작하기</MainBtn>
55 - onClick={onClick}
56 - color="#536349"
57 - style={{}}
58 - > 시작하기</Button>
59 - <MainImg src={mainImg}/>
60 </Container> 82 </Container>
83 + </Wrapper>
61 </> 84 </>
62 ); 85 );
63 } 86 }
......
...@@ -8617,6 +8617,13 @@ pnp-webpack-plugin@1.6.4: ...@@ -8617,6 +8617,13 @@ pnp-webpack-plugin@1.6.4:
8617 dependencies: 8617 dependencies:
8618 ts-pnp "^1.1.6" 8618 ts-pnp "^1.1.6"
8619 8619
8620 +polished@^4.0.5:
8621 + version "4.0.5"
8622 + resolved "https://registry.yarnpkg.com/polished/-/polished-4.0.5.tgz#3f91873c8f72dec1723b3f892f57fbb22645b23d"
8623 + integrity sha512-BY2+LVtOHQWBQpGN4GPAKpCdsBePOdSdHTpZegRDRCrvGPkRPTx1DEC+vGjIDPhXS7W2qiBxschnwRWTFdMZag==
8624 + dependencies:
8625 + "@babel/runtime" "^7.12.5"
8626 +
8620 portfinder@^1.0.26: 8627 portfinder@^1.0.26:
8621 version "1.0.28" 8628 version "1.0.28"
8622 resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.28.tgz#67c4622852bd5374dd1dd900f779f53462fac778" 8629 resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.28.tgz#67c4622852bd5374dd1dd900f779f53462fac778"
......