๐Ÿค ์€์ง€log ๐Ÿค

[REACT] Instagram _ Log-In ๋ณธ๋ฌธ

๐Ÿ’™ React

[REACT] Instagram _ Log-In

Eun_zii 2022. 10. 6. 13:52

 

 

Log-in

 

Sing-up

 

๐ŸŽฃ 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