Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: 3주차 과제 - ReactHookForm,BoilerTemplate,Refactor(Jeff) #3

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
da36850
🚩 init >> eslint, prettier, tailwind-css 설정
TransparentDeveloper Mar 18, 2024
8a19e0d
🎁 style >> input 컴포넌트 작성
TransparentDeveloper Mar 19, 2024
d8735ab
fix : rhf-input 컴포넌트, 에러감지 미동작 이슈 수정
TransparentDeveloper Mar 19, 2024
bf4e72a
feat : 과제 1 완료
TransparentDeveloper Mar 20, 2024
e6a88d3
init : spaghetti 프로젝트 개시
TransparentDeveloper Mar 20, 2024
2b4d870
feat : usePagenation 생성
TransparentDeveloper Mar 20, 2024
08dfc55
feat: pagination 컴포넌트 기능 구현
TransparentDeveloper Mar 21, 2024
76fe353
refactor: dia-log-provider 개선 & home-page 적용
TransparentDeveloper Mar 21, 2024
0fdbd10
remove: App.jsx 제거 & main.jsx worker, DiaLogProvider 설정
TransparentDeveloper Mar 21, 2024
9ae2cf9
remove: 다이어로그 표기법 변경 (DiaLog => Dialog)
TransparentDeveloper Mar 21, 2024
f0e2f5c
refactor : 다이어로그 표기법 변경 (DiaLog => Dialog)
TransparentDeveloper Mar 21, 2024
0851d1a
feat: 권한 여부에 따른 route 분기
TransparentDeveloper Mar 21, 2024
4a1de2a
refactor: dialog-provider, post-list-page 적용
TransparentDeveloper Mar 21, 2024
87eeeeb
feat : useFetchDataListAndPagination custom-hook 작성
TransparentDeveloper Mar 21, 2024
13a5401
feat : post-detail 패칭 함수 정의, 관련 page 에 loader 를 통해 적용
TransparentDeveloper Mar 21, 2024
7352f8a
refactor: router 관련 파일 정리
TransparentDeveloper Mar 22, 2024
3490151
refactor: alert => dialog 변경
TransparentDeveloper Mar 22, 2024
cbef131
feat: use-dialog 작성 & dialog 조작 간편화
TransparentDeveloper Mar 22, 2024
997ee6f
init : boiler-template 만들기 개시
TransparentDeveloper Mar 22, 2024
d74234a
feat : 과제 2 완료
TransparentDeveloper Mar 23, 2024
b3ccce7
readme : readme 수정
TransparentDeveloper Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mobi-2th-begginer-2
# mobi-2th-begginer-3
### 3주차
<a href="https://lyrical-brain-e0f.notion.site/mobi-beginner-week-3-0d1a1889390849729e292c60410a605e?pvs=4">@see</a>

Expand Down
33 changes: 33 additions & 0 deletions boiler-template/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:jsx-ally/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:prettier/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react'],
rules: {},
}
24 changes: 24 additions & 0 deletions boiler-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
17 changes: 17 additions & 0 deletions boiler-template/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": false,
"semi": false,
"experimentalTernaries": false,
"singleQuote": true,
"jsxSingleQuote": true,
"quoteProps": "as-needed",
"proseWrap": "preserve",
"insertPragma": false,
"printWidth": 80,
"requirePragma": false,
"tabWidth": 2,
"useTabs": true,
"embeddedLanguageFormatting": "auto"
}
11 changes: 11 additions & 0 deletions boiler-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 나만의 Boiler Template 만들기

## 환경 세팅

## 사용 라이브러리 목록

## 구현

### Component

### Config
13 changes: 13 additions & 0 deletions boiler-template/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
34 changes: 34 additions & 0 deletions boiler-template/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "boiler-template",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"styled-components": "^6.1.8"
},
"devDependencies": {
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^8.57.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"prettier": "^3.2.5",
"typescript": "^5.2.2",
"vite": "^5.2.0"
}
}
1 change: 1 addition & 0 deletions boiler-template/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions boiler-template/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function App() {
return <div>⛳️</div>
}

export default App
71 changes: 71 additions & 0 deletions boiler-template/src/components/structure/center.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {
ALIGN_CENTER,
FLEX_CENTER,
JUSTIFY_CENTER,
} from '@/libs/styled-components/util-css'
import type {
AxisType,
OptionalChromaType,
OptionalDirectionType,
OptionalPaddingSizeType,
OptionalSizeType,
} from '@/types'
import type {PropsWithChildren} from 'react'
import styled, {RuleSet, css} from 'styled-components'

interface CenterProps
extends OptionalSizeType,
OptionalChromaType,
OptionalDirectionType,
OptionalPaddingSizeType,
PropsWithChildren {}

/** 자식 컴포넌트 중앙 정렬 */
const Center = ({
width,
height,
direction = 'both',
bgColor = 'transparent',
px = '0rem',
py = '0rem',
children,
}: CenterProps) => {
return (
<S.Container
$width={width}
$height={height}
$bgColor={bgColor}
$px={px}
$py={py}
direction={direction}
>
{children}
</S.Container>
)
}

export default Center

const DirectionCSS: {[key in AxisType]: RuleSet} = {
both: css`
${FLEX_CENTER}
`,
horizontal: css`
${JUSTIFY_CENTER}
`,
vertical: css`
${ALIGN_CENTER}
`,
}

const Container = styled.div<CenterProps>`
width: ${({$width}) => $width};
height: ${({$height}) => $height};
background-color: ${({$bgColor}) => $bgColor};
padding: ${({$py, $px}) => `${$py} ${$px}`};
${({direction}) => DirectionCSS[direction!]}
`

const S = {
Container,
}
2 changes: 2 additions & 0 deletions boiler-template/src/components/structure/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './center'
export * from './symmetrical-padding'
65 changes: 65 additions & 0 deletions boiler-template/src/components/structure/symmetrical-padding.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import type {
OptionalChromaType,
OptionalPaddingSizeType,
OptionalSizeType,
} from '@/types'
import type {PropsWithChildren} from 'react'
import styled from 'styled-components'

interface PaddingProps
extends OptionalSizeType,
OptionalChromaType,
OptionalPaddingSizeType,
PropsWithChildren {}

export const Padding = ({
width = '0rem',
height = '0rem',
bgColor = 'transparent',
p = '0rem',
px,
py,
pt,
pb,
pr,
pl,
children,
}: PaddingProps) => {
return (
<S.Container
$width={width}
$height={height}
$bgColor={bgColor}
$p={p}
$px={px}
$py={py}
$pt={pt}
$pb={pb}
$pr={pr}
$pl={pl}
>
{children}
</S.Container>
)
}

const Container = styled.div<PaddingProps>`
width: ${({$width}) => $width};
height: ${({$height}) => $height};
background-color: ${({$bgColor}) => $bgColor};

padding: ${({$p}) => $p};

padding-left: ${({$px}) => !!$px && $px};
padding-right: ${({$px}) => !!$px && $px};
padding-top: ${({$py}) => !!$py && $py};
padding-bottom: ${({$py}) => !!$py && $py};

padding-left: ${({$pl}) => !!$pl && $pl};
padding-right: ${({$pr}) => !!$pr && $pr};
padding-top: ${({$pt}) => !!$pt && $pt};
padding-bottom: ${({$pb}) => !!$pb && $pb};
`
const S = {
Container,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BORDER_RADIUS = {} as const
1 change: 1 addition & 0 deletions boiler-template/src/libs/styled-components/tokens/color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const COLOR = {} as const
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FONT_SIZE = {} as const
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FONT_WEIGHT = {} as const
4 changes: 4 additions & 0 deletions boiler-template/src/libs/styled-components/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './border-radius'
export * from './color'
export * from './font-size'
export * from './font-weight'
30 changes: 30 additions & 0 deletions boiler-template/src/libs/styled-components/util-css/flex-layout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {css} from 'styled-components'

export const DIRECTION_COLUMN = css`
display: flex;
flex-direction: column;
`
export const ALIGN_CENTER = css`
display: flex;
align-items: center;
`
export const ALIGN_END = css`
display: flex;
align-items: end;
`
export const JUSTIFY_CENTER = css`
display: flex;
justify-content: center;
`
export const JUSTIFY_END = css`
display: flex;
justify-content: end;
`
export const FLEX_CENTER = css`
${ALIGN_CENTER}
${JUSTIFY_CENTER}
`
export const FLEX_END = css`
${ALIGN_END}
${JUSTIFY_END}
`
3 changes: 3 additions & 0 deletions boiler-template/src/libs/styled-components/util-css/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './flex-layout'
export * from './shadow'
export * from './solid-border-line'
33 changes: 33 additions & 0 deletions boiler-template/src/libs/styled-components/util-css/shadow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {css} from 'styled-components'

export const BOX_SHADOW_SMALL = css`
box-shadow: 0rem 0rem 0rem 'color';
`
export const BOX_SHADOW_MEDIUM = css`
box-shadow: 0rem 0rem 0rem 'color';
`
export const BOX_SHADOW_REGULAR = css`
box-shadow: 0rem 0rem 0rem 'color';
`
export const BOX_SHADOW_BIG = css`
box-shadow: 0rem 0rem 0rem 'color';
`
export const BOX_SHADOW_LARGE = css`
box-shadow: 0rem 0rem 0rem 'color';
`

export const TEXT_SHADOW_SMALL = css`
text-shadow: 0rem 0rem 0rem 'color';
`
export const TEXT_SHADOW_MEDIUM = css`
text-shadow: 0rem 0rem 0rem 'color';
`
export const TEXT_SHADOW_REGULAR = css`
text-shadow: 0rem 0rem 0rem 'color';
`
export const TEXT_SHADOW_BIG = css`
text-shadow: 0rem 0rem 0rem 'color';
`
export const TEXT_SHADOW_LARGE = css`
text-shadow: 0rem 0rem 0rem 'color';
`
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {css} from 'styled-components'

export const SOLID_BORDER_LINE_SMALL = css`
border: 0rem solid 'color';
`
export const SOLID_BORDER_LINE_MEDIUM = css`
border: 0rem solid 'color';
`
export const SOLID_BORDER_LINE_REGULAR = css`
border: 0rem solid 'color';
`
export const SOLID_BORDER_LINE_BIG = css`
border: 0rem solid 'color';
`
export const SOLID_BORDER_LINE_LARGE = css`
border: 0rem solid 'color';
`
Loading