Showing
3 changed files
with
58 additions
and
11 deletions
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 soldier from '../assets/soldier.png'; | 4 | +import soldier from "../assets/soldier.png"; |
5 | -import styled from "styled-components"; | 5 | +import styled, { css } from "styled-components"; |
6 | -import pattern from '../assets/mainPattern.jpeg'; | 6 | +import pattern from "../assets/mainPattern.jpeg"; |
7 | 7 | ||
8 | -const Wrapper = styled.div` | 8 | +const sizes = { |
9 | + desktop: 102.4, | ||
10 | + tablet: 76.8, | ||
11 | + phone: 36, | ||
12 | +}; | ||
13 | + | ||
14 | +const media = Object.keys(sizes).reduce((acc, label) => { | ||
15 | + acc[label] = (...args) => css` | ||
16 | + @media (max-width: ${sizes[label]}rem) { | ||
17 | + ${css(...args)} | ||
18 | + } | ||
19 | + `; | ||
20 | + return acc; | ||
21 | +}, {}); | ||
22 | + | ||
23 | +const WrapperContainer = styled.div` | ||
9 | width: 100%; | 24 | width: 100%; |
10 | height: 100vh; | 25 | height: 100vh; |
26 | +`; | ||
27 | + | ||
28 | +const Wrapper = styled.div` | ||
29 | + width: 100%; | ||
30 | + height: 100%; | ||
11 | background-image: url(${pattern}); | 31 | background-image: url(${pattern}); |
12 | background-repeat: no-repeat; // background-image가 컨테이너를 가득 채우지 못할 경우에도 반복하지 않는다. | 32 | background-repeat: no-repeat; // background-image가 컨테이너를 가득 채우지 못할 경우에도 반복하지 않는다. |
13 | background-size: cover; // 사이즈가 container에 맞지 않아도 꽉 차도록 채운다. | 33 | background-size: cover; // 사이즈가 container에 맞지 않아도 꽉 차도록 채운다. |
... | @@ -22,21 +42,41 @@ const Container = styled.div` | ... | @@ -22,21 +42,41 @@ const Container = styled.div` |
22 | color: #ffffff; | 42 | color: #ffffff; |
23 | `; | 43 | `; |
24 | 44 | ||
45 | +// 반응형 | ||
25 | const MainImg = styled.img` | 46 | const MainImg = styled.img` |
26 | - height: 50vh; | 47 | + width: 30rem; |
48 | + height: auto; | ||
49 | + ${media.tablet` | ||
50 | + width: 20rem; | ||
51 | + `} | ||
27 | `; | 52 | `; |
28 | 53 | ||
29 | const MainTitle = styled.div` | 54 | const MainTitle = styled.div` |
30 | - margin-top: 5rem; | 55 | + margin-top: 3rem; |
31 | text-align: center; | 56 | text-align: center; |
32 | font-size: 5rem; | 57 | font-size: 5rem; |
33 | font-weight: bold; | 58 | font-weight: bold; |
59 | + ${media.tablet` | ||
60 | + font-size: 4rem; | ||
61 | + `} | ||
34 | `; | 62 | `; |
35 | 63 | ||
36 | const MainDesc = styled.div` | 64 | const MainDesc = styled.div` |
37 | margin-top: 2rem; | 65 | margin-top: 2rem; |
38 | margin-bottom: 2rem; | 66 | margin-bottom: 2rem; |
39 | font-size: 1.5rem; | 67 | font-size: 1.5rem; |
68 | + ${media.tablet` | ||
69 | + font-size: 1.1rem; | ||
70 | + `} | ||
71 | +`; | ||
72 | + | ||
73 | +const MainBtnWrapper = styled.div` | ||
74 | + display: flex; | ||
75 | + justify-content: center; | ||
76 | + align-items: center; | ||
77 | + ${media.tablet` | ||
78 | + | ||
79 | + `} | ||
40 | `; | 80 | `; |
41 | 81 | ||
42 | const MainBtn = styled.div` | 82 | const MainBtn = styled.div` |
... | @@ -45,14 +85,18 @@ const MainBtn = styled.div` | ... | @@ -45,14 +85,18 @@ const MainBtn = styled.div` |
45 | justify-content: center; | 85 | justify-content: center; |
46 | align-items: center; | 86 | align-items: center; |
47 | margin-top: 1rem; | 87 | margin-top: 1rem; |
88 | + margin-bottom: 2rem; | ||
48 | width: 25rem; | 89 | width: 25rem; |
49 | height: 5rem; | 90 | height: 5rem; |
50 | font-size: 1.6rem; | 91 | font-size: 1.6rem; |
51 | font-weight: bold; | 92 | font-weight: bold; |
52 | border-radius: 1rem; | 93 | border-radius: 1rem; |
53 | border: 1px solid #010101; | 94 | border: 1px solid #010101; |
95 | + color: #ffffff; | ||
54 | background-color: #3c441d; | 96 | background-color: #3c441d; |
55 | - &:hover{ | 97 | + transform: background-color; |
98 | + transition: ease-out 0.3s; | ||
99 | + &:hover { | ||
56 | background-color: #ffffff; | 100 | background-color: #ffffff; |
57 | color: #010101; | 101 | color: #010101; |
58 | } | 102 | } |
... | @@ -70,6 +114,7 @@ function MainPage({ history }) { | ... | @@ -70,6 +114,7 @@ function MainPage({ history }) { |
70 | 114 | ||
71 | return ( | 115 | return ( |
72 | <> | 116 | <> |
117 | + <WrapperContainer> | ||
73 | <Wrapper> | 118 | <Wrapper> |
74 | <Container> | 119 | <Container> |
75 | <MainTitle>KHUSAT</MainTitle> | 120 | <MainTitle>KHUSAT</MainTitle> |
... | @@ -78,9 +123,12 @@ function MainPage({ history }) { | ... | @@ -78,9 +123,12 @@ function MainPage({ history }) { |
78 | 여러분의 보직을 추천드립니다. | 123 | 여러분의 보직을 추천드립니다. |
79 | </MainDesc> | 124 | </MainDesc> |
80 | <MainImg src={soldier} /> | 125 | <MainImg src={soldier} /> |
81 | - <MainBtn onClick={onClick}>시작하기</MainBtn> | ||
82 | </Container> | 126 | </Container> |
127 | + <MainBtnWrapper> | ||
128 | + <MainBtn onClick={onClick}>시작하기</MainBtn> | ||
129 | + </MainBtnWrapper> | ||
83 | </Wrapper> | 130 | </Wrapper> |
131 | + </WrapperContainer> | ||
84 | </> | 132 | </> |
85 | ); | 133 | ); |
86 | } | 134 | } | ... | ... |
... | @@ -6,7 +6,7 @@ const Container = styled.div` | ... | @@ -6,7 +6,7 @@ const Container = styled.div` |
6 | flex-direction: column; | 6 | flex-direction: column; |
7 | justify-content: center; | 7 | justify-content: center; |
8 | align-items: center; | 8 | align-items: center; |
9 | - margin-top: 100px; | 9 | + margin-top: 10rem; |
10 | `; | 10 | `; |
11 | 11 | ||
12 | const Title = styled.div` | 12 | const Title = styled.div` | ... | ... |
... | @@ -3,14 +3,13 @@ import Card from "../components/card/Card"; | ... | @@ -3,14 +3,13 @@ import Card from "../components/card/Card"; |
3 | import {useDispatch} from 'react-redux'; | 3 | import {useDispatch} from 'react-redux'; |
4 | import {getResultThunk} from "../store/action/result"; | 4 | import {getResultThunk} from "../store/action/result"; |
5 | import "antd/dist/antd.css"; | 5 | import "antd/dist/antd.css"; |
6 | -import mainPattern from "../assets/mainPattern.jpeg"; | ||
7 | 6 | ||
8 | import styled, { css } from "styled-components"; | 7 | import styled, { css } from "styled-components"; |
9 | 8 | ||
10 | const SurveyContainer = styled.div` | 9 | const SurveyContainer = styled.div` |
11 | display: flex; | 10 | display: flex; |
12 | justify-content: center; | 11 | justify-content: center; |
13 | - background-image: url(${mainPattern}); | 12 | + // 얘도 배경 고려해보기 |
14 | `; | 13 | `; |
15 | 14 | ||
16 | const Container = styled.div` | 15 | const Container = styled.div` | ... | ... |
-
Please register or login to post a comment