Skip to content

Commit

Permalink
Initialize Project
Browse files Browse the repository at this point in the history
  • Loading branch information
김지수 committed Jan 27, 2022
1 parent 2c11cc4 commit 38716bc
Show file tree
Hide file tree
Showing 36 changed files with 36,552 additions and 51 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/build

# misc
.env
.DS_Store
.env.local
.env.development.local
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"classnames": "^2.3.1",
"dotenv": "^14.3.2",
"polished": "^4.1.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-google-login": "^5.2.2",
"react-icons": "^4.3.1",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"styled-components": "^5.3.3",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
17 changes: 1 addition & 16 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,7 @@
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Devoard</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
37 changes: 20 additions & 17 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import logo from './logo.svg';
import './App.css';
import { Routes, Route } from 'react-router-dom'
import { ThemeProvider } from 'styled-components';
import Home from './pages/Home';
import Callback from './pages/Callback';
import NotFound from './pages/NotFound';

function App() {

const App = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<ThemeProvider
theme={{
palette: {
orange: '#FFB200'
}
}}
>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/callback" element={<Callback />} />
<Route path="*" element={<NotFound />} />
</Routes>
</ThemeProvider>
</div>
);
}
Expand Down
Binary file added src/assets/images/githubIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/googleIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import styled, { css } from 'styled-components';
import { darken, lighten } from 'polished';


const colorStyles = css`
${({ theme, color }) => {
const selected = theme.palette[color];
return css`
background: ${selected};
${props =>
props.outline &&
css`
color: ${selected};
background: none;
border: 2px solid ${selected};
`
}
`;
}}
`;

const StyledButton = styled.button`
background: transparent;
color: white;
height: 2.125rem;
font-family: var(--font-title);
font-size: 1.125rem;
line-height: 1.7rem;
padding: 0 1.5rem;
border-radius: 1.25rem;
cursor: pointer;
${colorStyles}
`;




const Button = ({ children, color, outline, ...rest }) => {
return (
<StyledButton
color={color}
outline={outline}
{...rest}
>
{children}
</StyledButton>
);
}

export default Button;
48 changes: 48 additions & 0 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { useState, useEffect } from 'react';
import LoginPopUp from '../components/LoginPopUp';
import {
HeaderWrapper,
Logo,
UserMenuWrapper,
UserIcon,
LoginBtn
} from '../styles/Header'

const Header = () => {
const [isLogin, setIsLogin] = useState(false);
const [isLoginPopUp, setIsLoginPopUp] = useState(false);

const onToggleLogin = () => {
if (isLogin == true) {
setIsLogin(false);
}
else if (isLogin === false) {
setIsLogin(true);
}
}

return (
<>
<HeaderWrapper>
<Logo>Devoard</Logo>
<UserMenuWrapper>
<UserIcon />
<LoginBtn
color='orange'
outline
onClick={()=>{setIsLoginPopUp(true)}}
>
로그인
</LoginBtn>
</UserMenuWrapper>
</HeaderWrapper>
<LoginPopUp
isVisible={isLoginPopUp}
setIsLoginPopUp={setIsLoginPopUp}
>
</LoginPopUp>
</>
);
}

export default Header;
119 changes: 119 additions & 0 deletions src/components/LoginPopUp.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import styled from "styled-components";
import GoogleLogin from 'react-google-login'
import githubIcon from '../assets/images/githubIcon.png';
import googleIcon from '../assets/images/googleIcon.png';
import { IoIosClose } from 'react-icons/io';

const PopUpBackground = styled.div`
display: flex;
justify-content: center;
align-items: center;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(0, 0, 0, 0.5);
`;

const PopUpWrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
width: 80%;
height: 400px;
background: white;
border-radius: 0.7rem;
position: relative;
.icon {
position: absolute;
right: 0;
top: 0;
cursor: pointer;
}
`;

const IconWrapper = styled.div``;

const Icon = styled.img`
width: 4rem;
height: 4rem;
margin: 0 2rem;
border-radius: 1px solid gray;
cursor: pointer;
`;

const GithubLink = styled.a``;

const GithubIcon = styled(Icon).attrs({
src: `${githubIcon}`
})``;



const onSuccess = async(res) => {
console.log(res);
}

const onFailure = (err) => {
console.log(err);
}

const LoginPopUp = ({ isVisible, setIsLoginPopUp }) => {
if (!isVisible) return null;


return (
<PopUpBackground>
<PopUpWrapper>
<IoIosClose
className="icon"
size="40"
onClick={()=>{setIsLoginPopUp(false)}}
/>
<IconWrapper>
<GoogleLogin
render={ renderProps => (
<button
onClick={renderProps.onClick}
disabled={renderProps.disabled}
style={{
background: 'none',
outline: 'none',
border: 'none',
cursor: 'pointer'
}}
>
<img
src={googleIcon}
alt="google login icon"
style={{
width: "4rem",
height: "4rem",
borderRadius: "50%",
}}
/>
</button>
)}
clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}
responseType={"id_token"}
onSuccess={onSuccess}
onFailure={onFailure}
/>
<GithubLink
href={`https://github.com/login/oauth/authorize?client_id=${process.env.REACT_APP_GITHUB_CLIENT_ID}&redirect_uri=https://localhost:3000`}
>
<GithubIcon />
</GithubLink>

</IconWrapper>
</PopUpWrapper>
</PopUpBackground>

);
}

export default LoginPopUp;
69 changes: 60 additions & 9 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
@import
url('https://cdn.rawgit.com/moonspam/NanumSquare/master/nanumsquare.css');

@font-face {
font-family: 'SpoqaHanSansNeo-Regular';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SpoqaHanSansNeo-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'yg-jalnan';
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/JalnanOTF00.woff') format('woff');
font-weight: normal;
font-style: normal;
}


@media (min-width: 1920px) {
body {width: 1680px;}
}

@media (max-width: 1919px) {
body {width: 1420px;}
}

@media (max-width: 1400px) {
body {
width: 1024px;
}
}


:root {
--font-body: 'NanumSquare';
--font-title: 'SpoqaHanSansNeo-Regular';
--font-logo: 'yg-jalnan';
}


html {
background: #080e1d;
width: 100%;
display: flex;
justify-content: center;
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
padding: 0px 20px;
font-family: var(--font-body);
font-size: 16px;
line-height: 1.5rem;
color: #3A3D3E;
-ms-overflow-style: none;

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

::-webkit-scrollbar { display: none; }

.title {
font-family: var(--font-title);
font-size: 30px;
}
Loading

0 comments on commit 38716bc

Please sign in to comment.