Skip to content

Commit e041015

Browse files
authored
✨ 트러플 로그인 화면 ui 구현 (#15)
1 parent a569e65 commit e041015

File tree

8 files changed

+350
-158
lines changed

8 files changed

+350
-158
lines changed

apps/truffle-webclient/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
},
1111
"dependencies": {
1212
"react": "^18.2.0",
13-
"react-dom": "^18.2.0"
13+
"react-dom": "^18.2.0",
14+
"styled-components": "^5.3.9"
1415
},
1516
"devDependencies": {
1617
"@types/react": "^18.0.28",
1718
"@types/react-dom": "^18.0.11",
19+
"@types/styled-components": "^5.1.26",
1820
"@vitejs/plugin-react-swc": "^3.0.0",
19-
"typescript": "^4.9.3",
21+
"typescript": "^5.0.3",
2022
"vite": "^4.2.0"
2123
}
2224
}

apps/truffle-webclient/src/App.css

Lines changed: 0 additions & 42 deletions
This file was deleted.

apps/truffle-webclient/src/App.tsx

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,19 @@
1-
import { useState } from 'react'
2-
import reactLogo from './assets/react.svg'
3-
import viteLogo from '/vite.svg'
4-
import './App.css'
1+
import { createGlobalStyle } from "styled-components";
2+
import { LoginPage } from "./pages/LoginPage";
53

64
function App() {
7-
const [count, setCount] = useState(0)
8-
95
return (
10-
<div className="App">
11-
<div>
12-
<a href="https://vitejs.dev" target="_blank">
13-
<img src={viteLogo} className="logo" alt="Vite logo" />
14-
</a>
15-
<a href="https://reactjs.org" target="_blank">
16-
<img src={reactLogo} className="logo react" alt="React logo" />
17-
</a>
18-
</div>
19-
<h1>Vite + React</h1>
20-
<div className="card">
21-
<button onClick={() => setCount((count) => count + 1)}>
22-
count is {count}
23-
</button>
24-
<p>
25-
Edit <code>src/App.tsx</code> and save to test HMR
26-
</p>
27-
</div>
28-
<p className="read-the-docs">
29-
Click on the Vite and React logos to learn more
30-
</p>
31-
</div>
32-
)
6+
<>
7+
<GlobalStyle />
8+
<LoginPage />
9+
</>
10+
);
3311
}
3412

35-
export default App
13+
export default App;
14+
15+
const GlobalStyle = createGlobalStyle`
16+
body {
17+
margin: 0;
18+
}
19+
`;

apps/truffle-webclient/src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/truffle-webclient/src/index.css

Lines changed: 0 additions & 69 deletions
This file was deleted.

apps/truffle-webclient/src/main.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import React from 'react'
2-
import ReactDOM from 'react-dom/client'
3-
import App from './App'
4-
import './index.css'
1+
import ReactDOM from "react-dom/client";
2+
import App from "./App";
3+
import { StrictMode } from "react";
54

6-
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
7-
<React.StrictMode>
5+
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
6+
<StrictMode>
87
<App />
9-
</React.StrictMode>,
10-
)
8+
</StrictMode>
9+
);
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import styled, { createGlobalStyle } from "styled-components";
2+
3+
export const LoginPage = () => {
4+
return (
5+
<Wrapper>
6+
<Left />
7+
<Right>
8+
<LoginButton>LOG IN VIA GITHUB</LoginButton>
9+
</Right>
10+
</Wrapper>
11+
);
12+
};
13+
14+
const Wrapper = styled.div`
15+
display: flex;
16+
height: 100vh;
17+
`;
18+
19+
const Left = styled.div`
20+
flex: 1;
21+
background-image: url("https://avatars.slack-edge.com/2023-01-09/4602907042359_26481362e89cf34f3794_192.jpg");
22+
background-repeat: no-repeat;
23+
background-size: cover;
24+
background-position: center;
25+
`;
26+
27+
const Right = styled.div`
28+
width: max(25%, 300px);
29+
background-color: #f5f5f5;
30+
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.5);
31+
display: flex;
32+
flex-direction: column;
33+
align-items: center;
34+
padding: 200px 20px;
35+
`;
36+
37+
const LoginButton = styled.button`
38+
background-color: #000;
39+
color: #fff;
40+
border: none;
41+
padding: 20px 30px;
42+
border-radius: 5px;
43+
font-size: 16px;
44+
font-weight: bold;
45+
margin-top: 20px;
46+
cursor: pointer;
47+
transition: 0.2s;
48+
49+
&:hover {
50+
background-color: #333;
51+
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.5);
52+
}
53+
`;

0 commit comments

Comments
 (0)