Skip to content

Commit

Permalink
chore: 개발 환경 세팅
Browse files Browse the repository at this point in the history
- Recoil 설정
- React-query 설정
- globalStyles 설정
- Header 및 routing 구현
#2
  • Loading branch information
rjsduf0503 committed Aug 8, 2022
1 parent e9aad6f commit 5a5ecd7
Show file tree
Hide file tree
Showing 22 changed files with 952 additions and 88 deletions.
12 changes: 11 additions & 1 deletion frontend/web/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@
"object-shorthand": 0,
"react-hooks/rules-of-hooks": 0,
"array-callback-return": 0,
"prefer-destructuring": 0
"prefer-destructuring": 0,
"react/function-component-definition": [
2,
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
"react/prop-types": "off", // Since we do not use prop-types
"react/require-default-props": "off", // Since we do not use prop-types
"@typescript-eslint/no-empty-function": "off"
}
}
648 changes: 648 additions & 0 deletions frontend/web/package-lock.json

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion frontend/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@tanstack/react-query": "^4.0.10",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -12,15 +13,21 @@
"@types/react-dom": "^18.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"recoil": "^0.7.4",
"styled-components": "^5.3.5",
"typescript": "^4.7.4",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"lint": "eslint './src/**/*.{ts,tsx}'",
"lint:fix": "eslint --fix './src/**/*.{ts,tsx}'",
"prettier": "prettier --write --config ./.prettierrc './src/**/*.{ts,tsx}'"
},
"eslintConfig": {
"extends": [
Expand All @@ -39,5 +46,20 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/styled-components": "^5.1.25",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"eslint": "^8.16.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.5.0",
"prettier": "^2.6.2"
}
}
Binary file removed frontend/web/public/favicon.ico
Binary file not shown.
50 changes: 10 additions & 40 deletions frontend/web/public/index.html
Original file line number Diff line number Diff line change
@@ -1,43 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
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>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Meeting management system" />
<title>Meeting management system</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
Binary file removed frontend/web/public/logo192.png
Binary file not shown.
Binary file removed frontend/web/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions frontend/web/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions frontend/web/public/robots.txt

This file was deleted.

16 changes: 0 additions & 16 deletions frontend/web/src/App.tsx

This file was deleted.

Binary file added frontend/web/src/assets/fonts/inter.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions frontend/web/src/atom.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { atom } from 'recoil';

export {};
44 changes: 44 additions & 0 deletions frontend/web/src/components/atoms/text.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';

type textProps = {
children: string;
fontSize?: number;
fontWeight?: string | number;
letterSpacing?: string | number;
onClick?: (e: any) => void;
};

const Text: React.FC<textProps> = ({
children,
fontSize = 1.2,
fontWeight = 'normal',
letterSpacing = 'normal',
onClick,
}: textProps) => {
return onClick ? (
<button
type='button'
style={{
fontSize: `${fontSize}rem`,
fontWeight: fontWeight,
letterSpacing: `${letterSpacing}rem`,
fontFamily: 'inter',
}}
onClick={onClick}
>
{children}
</button>
) : (
<span
style={{
fontSize: `${fontSize}rem`,
fontWeight: fontWeight,
letterSpacing: `${letterSpacing}rem`,
}}
>
{children}
</span>
);
};

export default Text;
23 changes: 23 additions & 0 deletions frontend/web/src/components/molecules/flex_row.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React, { ReactNode } from 'react';
import styled from 'styled-components';

const Container = styled.div<{ needMargin: boolean }>`
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: row;
margin-top: ${(props) => (props.needMargin ? '2rem' : 0)};
margin-left: ${(props) => (props.needMargin ? '5%' : 0)};
margin-right: ${(props) => (props.needMargin ? '5%' : 0)};
`;

type FlexRowProps = {
children: ReactNode;
needMargin?: boolean;
};

const FlexRow: React.FC<FlexRowProps> = ({ children, needMargin = false }: FlexRowProps) => {
return <Container needMargin={needMargin}>{children}</Container>;
};

export default FlexRow;
16 changes: 16 additions & 0 deletions frontend/web/src/components/molecules/logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import Text from '../atoms/text';

type LogoProps = {
onClick?: (e: any) => void;
};

const Logo: React.FC<LogoProps> = ({ onClick = () => {} }: LogoProps) => {
return (
<Text fontSize={2.4} fontWeight={900} letterSpacing='0.4' onClick={onClick}>
LUCENTBLOCK
</Text>
);
};

export default Logo;
25 changes: 25 additions & 0 deletions frontend/web/src/components/molecules/nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import styled from 'styled-components';
import Text from '../atoms/text';
import FlexRow from './flex_row';

const Li = styled.li`
margin: 0 0 0 4rem;
`;

const Nav: React.FC = () => {
return (
<ul>
<FlexRow>
<Li>
<Text onClick={() => console.log('login clicked')}>로그인</Text>
</Li>
<Li>
<Text onClick={() => console.log('signup clicked')}>회원가입</Text>
</Li>
</FlexRow>
</ul>
);
};

export default Nav;
17 changes: 17 additions & 0 deletions frontend/web/src/components/organisms/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import Nav from '../molecules/nav';
import Logo from '../molecules/logo';
import FlexRow from '../molecules/flex_row';

const Header: React.FC = () => {
const navigate = useNavigate();
return (
<FlexRow needMargin>
<Logo onClick={() => navigate('/')} />
<Nav />
</FlexRow>
);
};

export default Header;
76 changes: 76 additions & 0 deletions frontend/web/src/globalStyles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { createGlobalStyle } from 'styled-components';

const GlobalStyle = createGlobalStyle`
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400&display=swap');
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, menu, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
main, menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, main, menu, nav, section {
display: block;
}
/* HTML5 hidden-attribute fix for newer browsers */
*[hidden] {
display: none;
}
body {
line-height: 1;
}
menu, ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
* {
box-sizing: border-box;
}
body {
font-weight: 300;
font-family: 'Source Sans Pro', sans-serif;
color:black;
line-height: 1.2;
}
a {
text-decoration:none;
color:inherit;
}
button {
border: none;
background-color: transparent;
cursor: pointer;
}
@font-face {
font-family: 'inter';
src: url('./assets/fonts/inter.ttf');
}
`;

export default GlobalStyle;
Loading

0 comments on commit 5a5ecd7

Please sign in to comment.