안형욱

Merge branch 'style/login-page' into 'develop'

Style/login page



See merge request !4
1 import React from 'react'; 1 import React from 'react';
2 +import { createGlobalStyle } from 'styled-components';
2 import { BrowserRouter, Route, Switch } from 'react-router-dom'; 3 import { BrowserRouter, Route, Switch } from 'react-router-dom';
3 import Home from './pages/Home'; 4 import Home from './pages/Home';
5 +import LoginPage from './pages/LoginPage';
6 +
7 +const GlobalStyle = createGlobalStyle`
8 + html,
9 + body,
10 + #root {
11 + margin: 0;
12 + padding: 0;
13 + height: 100%;
14 + }
15 + html {
16 + box-sizing: border-box;
17 +
18 + * {
19 + box-sizing: inherit;
20 + }
21 + }
22 +`;
4 23
5 const App = () => ( 24 const App = () => (
6 <BrowserRouter> 25 <BrowserRouter>
26 + <GlobalStyle />
7 <Switch> 27 <Switch>
8 <Route path="/" exact component={Home} /> 28 <Route path="/" exact component={Home} />
29 + <Route path="/login" exact component={LoginPage} />
9 </Switch> 30 </Switch>
10 </BrowserRouter> 31 </BrowserRouter>
11 ); 32 );
......
1 +import React from 'react';
2 +import { Link } from 'react-router-dom';
3 +import styled from 'styled-components';
4 +import palette from '../lib/styles/palette';
5 +import Button from './common/Button';
6 +
7 +const FormBlock = styled.form`
8 + position: absolute;
9 + top: 50%;
10 + left: 50%;
11 + transform: translate(-50%, -50%);
12 + width: 25rem;
13 + padding: 2.5rem;
14 + box-sizing: border-box;
15 + border: 1px solid #dadce0;
16 + -webkit-border-radius: 8px;
17 + border-radius: 8px;
18 + text-align: center;
19 +`;
20 +
21 +const InputBox = styled.div`
22 + position: relative;
23 + input {
24 + width: 93%;
25 + padding: 0.625rem 10px;
26 + font-size: 1rem;
27 + letter-spacing: 0.062rem;
28 + margin-bottom: 1.875rem;
29 + border: 1px solid #ccc;
30 + background: transparent;
31 + border-radius: 4px;
32 + }
33 + .label {
34 + position: absolute;
35 + top: 0;
36 + left: 10px;
37 + padding: 0.625rem 0;
38 + font-size: 1rem;
39 + color: grey;
40 + pointer-events: none;
41 + transition: 0.5s;
42 + }
43 +
44 + input:focus ~ .label,
45 + input:valid ~ .label,
46 + input:not([value='']) ~ .label {
47 + top: -1.125rem;
48 + left: 10px;
49 + color: ${palette.blue6};
50 + font-size: 0.75rem;
51 + background-color: #fff;
52 + height: 10px;
53 + padding-left: 5px;
54 + padding-right: 5px;
55 + }
56 +
57 + input:focus {
58 + outline: none;
59 + border: 2px solid ${palette.blue6};
60 + }
61 + input[type='submit'] {
62 + border: none;
63 + outline: none;
64 + color: #fff;
65 + background-color: ${palette.blue6};
66 + padding: 0.625rem 1.25rem;
67 + cursor: pointer;
68 + border-radius: 0.312rem;
69 + font-size: 1rem;
70 + float: right;
71 + }
72 +
73 + input[type='submit']:hover {
74 + background-color: ${palette.blue6};
75 + box-shadow: 0 1px 1px 0 rgba(66, 133, 244, 0.45),
76 + 0 1px 3px 1px rgba(66, 133, 244, 0.3);
77 + }
78 +`;
79 +
80 +const ButtonBlock = styled.div`
81 + display: flex;
82 + justify-content: space-between;
83 + padding: 1rem;
84 +
85 + a {
86 + color: ${palette.blue6};
87 + text-decoration: none;
88 + }
89 +`;
90 +
91 +const Login = () => {
92 + return (
93 + <FormBlock>
94 + <div>Logo</div>
95 + <h1>로그인</h1>
96 + <InputBox>
97 + <input type="email" id="email" name="email" value="" />
98 + <div className="label">Email</div>
99 + </InputBox>
100 + <InputBox>
101 + <input type="text" name="text" value="" />
102 + <div className="label">Password</div>
103 + </InputBox>
104 + <ButtonBlock>
105 + <Link to="/">홈으로</Link>
106 + <Button color="blue">로그인</Button>
107 + </ButtonBlock>
108 + </FormBlock>
109 + );
110 +};
111 +
112 +export default Login;
1 +import React from 'react';
2 +import Login from '../components/Login';
3 +
4 +const LoginPage = () => {
5 + return (
6 + <>
7 + <Login />
8 + </>
9 + );
10 +};
11 +
12 +export default LoginPage;
No preview for this file type