๐ค ์์งlog ๐ค
[REACT] Instagram _ Log-In ๋ณธ๋ฌธ
๐ฃ 1. Router.js ์์ฑ
import { BrowserRouter, Routes, Route } from 'react-router-dom'
import { Login, Main, Signup } from './Components/Pages'
const Router = () => {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<Main />} />
<Route path="/login" element={<Login />} />.
<Route path="/signup" element={<Signup />} />.
</Routes>
</BrowserRouter>
)
}
export default Router
๐ฃ 2. index.js
export { default as Login } from './Login'
export { default as Main } from './Main'
export { default as Signup } from './Signup'
๐ฃ 2-1. App.js ์ Router โก import
import Router from './Router'
function App() {
return <Router />
}
export default App
๐ฃ 3. Login.jsx ์์ฑ
import styled from 'styled-components'
import { Link } from 'react-router-dom'
import {
PageWrapper,
Main,
Box,
Logo,
BtnSubmit,
Form,
InputText,
SignupWrapper,
CustomLink,
} from '../atoms/login'
import { FaFacebook } from 'react-icons/fa'
const Login = () => {
return (
<PageWrapper>
<Main>
<Box>
<Logo src="https://cdn.apple-economy.com/news/photo/201612/30523_15394_5059.png" />
<Form>
<InputText placeholder="์ ํ๋ฒํธ, ์ฌ์ฉ์ ์ด๋ฆ ๋๋ ์ด๋ฉ์ผ" />
<InputText placeholder="๋น๋ฐ๋ฒํธ" type="password" />
<BtnSubmit>๋ก๊ทธ์ธ</BtnSubmit>
</Form>
<FBLogin>
<FaFacebook></FaFacebook>Facebook์ผ๋ก ๋ก๊ทธ์ธ
</FBLogin>
<ForgotPassword>๋น๋ฐ๋ฒํธ๋ฅผ ์์ผ์
จ๋์?</ForgotPassword>
</Box>
<Box>
<SignupWrapper>
๊ณ์ ์ด ์์ผ์ ๊ฐ์? <CustomLink to="/Signup">๊ฐ์
ํ๊ธฐ</CustomLink>
</SignupWrapper>
</Box>
</Main>
</PageWrapper>
)
}
const FBLogin = styled.div`
color: #385185;
font-weight: bold;
font-size: 14px;
margin-top: 30px;
`
const ForgotPassword = styled.div`
font-size: 12px;
margin-top: 20px;
`
export default Login
๐ฃ 4. Signup.jsx ์์ฑ
import styled from 'styled-components'
import { Link } from 'react-router-dom'
import {
PageWrapper,
Main,
Box,
Logo,
BtnSubmit,
Form,
InputText,
SignupWrapper,
CustomLink,
} from '../atoms/login'
import { FaFacebook } from 'react-icons/fa'
const Signup = () => {
return (
<PageWrapper>
<Main>
<Box>
<Logo src="https://cdn.apple-economy.com/news/photo/201612/30523_15394_5059.png" />
<Welcom>์น๊ตฌ๋ค์ ์ฌ์ง๊ณผ ๋์์์ ๋ณด๋ ค๋ฉด ๊ฐ์
ํ์ธ์.</Welcom>
<BtnSubmit>
<FaFacebook></FaFacebook>Facebook์ผ๋ก ๋ก๊ทธ์ธ
</BtnSubmit>
<Form>
<InputText placeholder="์ฑ๋ช
" />
<InputText placeholder="์ฌ์ฉ์ ์ด๋ฆ" />
<InputText placeholder="๋น๋ฐ๋ฒํธ" type="password" />
<BtnSubmit>๊ฐ์
</BtnSubmit>
</Form>
</Box>
<Box>
<SignupWrapper>
๊ณ์ ์ด ์์ผ์ ๊ฐ์? <CustomLink to="/Login">๋ก๊ทธ์ธ</CustomLink>
</SignupWrapper>
</Box>
</Main>
</PageWrapper>
)
}
const Welcom = styled.div`
display: flex;
flex-direction: column;
`
export default Signup
๐ฃ 5. atoms ํด๋ ์์ฑ ํ Login.js ์์ฑ
import styled from 'styled-components'
import { Link } from 'react-router-dom'
export const PageWrapper = styled.div`
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #fafafa;
`
export const Main = styled.div`
width: 350px;
`
export const Box = styled.div`
background: #fff;
border: 1px solid #dbdbdb;
padding: 10px 0;
text-align: center;
margin-bottom: 10px;
`
export const Logo = styled.img`
width: 230px;
`
export const Form = styled.form`
display: flex;
flex-direction: column;
padding: 0 40px;
margin-top: 24px;
`
export const InputText = styled.input`
height: 36px;
background: #fafafa;
border: 1px solid #dbdbdb;
border-radius: 3px;
padding-left: 8px;
& + & {
margin-top: 6px;
}
`
export const BtnSubmit = styled.button`
background: #0095f6;
color: #fff;
border: none;
border-radius: 4px;
padding: 5px 9px;
font-weight: bold;
margin: 8px 0;
`
export const SignupWrapper = styled.div`
padding: 15px 0;
font-size: 14px;
`
export const CustomLink = styled(Link)`
text-decoration: none;
font-weight: bold;
color: #0095f6;
`
๐ Login.jsx ์ Signup.jsx ์์ ์ค๋ณต๋๋ styled-components๋ค์ ํ๋๋ก ๋ฌถ์ํ ๊ฐ ๊ฐ import ํด์ฃผ๊ธฐ
import {
PageWrapper,
Main,
Box,
Logo,
BtnSubmit,
Form,
InputText,
SignupWrapper,
CustomLink,
} from '../atoms/login'
728x90
'๐ React' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[REACT] To-do List ๋ง๋ค๊ธฐ (0) | 2022.10.06 |
---|---|
[REACT] Pagination ๊ณผ Querystring (0) | 2022.10.06 |
[REACT] Naver ์ฑ ๊ฒ์ (0) | 2022.10.06 |
[REACT] Naver ์ํ ๊ฒ์ (0) | 2022.10.06 |
[REACT] Modal (0) | 2022.10.06 |