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

[장바구니 협업 Step 1] 황펭(양이진) 미션 제출합니다. #83

Merged
merged 25 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
38c3454
chore: 이전 미션 코드 가져오기
Leejin-Yang May 23, 2023
a525332
docs: 요구 사항 작성
Leejin-Yang May 23, 2023
d545f63
feat: SelectBox 컴포넌트 작성
Leejin-Yang May 23, 2023
32d1242
feat: 서버 이름 상태 구현
Leejin-Yang May 23, 2023
42bbc96
fix: ErrorBoundary key 추가로 에러 리셋 적용
Leejin-Yang May 23, 2023
ccb95a2
feat: 백엔드 장바구니 api 요청 적용
Leejin-Yang May 23, 2023
a256c54
refactor: name을 serverName으로 통일
Leejin-Yang May 23, 2023
5130caf
refactor: 서버 이름 배열 상수화
Leejin-Yang May 23, 2023
873b220
refactor: 서버 이름 타입 가드 함수 이동
Leejin-Yang May 23, 2023
2864f72
feat: fetch 에러 처리
Leejin-Yang May 24, 2023
549b4c7
fix: 상품 아이디를 장바구니 아이디로 수정
Leejin-Yang May 24, 2023
84e19b5
refactor: 서버 이름 기본값 배열 요소로 수정
Leejin-Yang May 24, 2023
a45c45c
refactor: 수량 0개일 때 삭제 요청
Leejin-Yang May 24, 2023
ed87664
refactor: 서버 주소, 아이디, 패스워드 환경변수로 수정
Leejin-Yang May 24, 2023
086f996
refactor: 수량 변경 커스텀 훅 AmountCounter로 이동
Leejin-Yang May 24, 2023
f2118e8
feat: 요청에 대한 토스트 메시지 구현
Leejin-Yang May 24, 2023
2d26645
refactor: 장바구니 목록 요청 recoil에서 커스텀 훅으로 변경
Leejin-Yang May 24, 2023
755ff1c
refactor: 페이지 레이아웃 분리
Leejin-Yang May 24, 2023
b7061f4
refactor: 장바구니 선택 기능 수정
Leejin-Yang May 25, 2023
d0fc663
refactor: 장바구니 상품 요청 이동 및 스토리북 수정
Leejin-Yang May 25, 2023
5633a4e
build: 홈페이지 변경 및 workflow 브랜치 수정
Leejin-Yang May 25, 2023
657ff0f
docs: 요구사항 문서 업데이트
Leejin-Yang May 25, 2023
d40238d
fix: base url 수정
Leejin-Yang May 25, 2023
079c590
fix: base url 설정
Leejin-Yang May 25, 2023
52ad953
chore: gh-pages 추가
Leejin-Yang May 25, 2023
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
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: NodeJS with Webpack

on:
push:
branches: ['step1']

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

restore-keys: |
${{ runner.os }}-node-

- name: Install Dependencies

if: steps.cache.outputs.cache-hit != 'true'
run: npm ci --legacy-peer-deps

- name: Build
run: CI='' npm run build

- name: Build Storybook
run: |
npm run build-storybook
mv ./storybook-static ./build/storybook

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
20 changes: 20 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { StorybookConfig } from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/preset-create-react-app',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
staticDirs: ['../public'],
};
export default config;
64 changes: 64 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React from 'react';
import { Preview } from '@storybook/react';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import { RecoilRoot } from 'recoil';
import { BrowserRouter } from 'react-router-dom';
import { initialize, mswDecorator } from 'msw-storybook-addon';
import { ThemeProvider } from 'styled-components';

import GlobalStyle from '../src/styles';
import theme from '../src/styles/theme';
import { handlers } from '../src/mocks/handlers';

let options = {};
if (location.hostname === 'leejin-yang.github.io') {
options = {
serviceWorker: {
url: '/react-shopping-cart/mockServiceWorker.js',
},
};
}

initialize(options);

export const decorators = [
(Story) => (
<BrowserRouter>
<RecoilRoot>
<ThemeProvider theme={theme}>
<GlobalStyle />
<Story />
</ThemeProvider>
</RecoilRoot>
</BrowserRouter>
),
mswDecorator,
];

const customViewports = {
desktop: {
name: 'Desktop',
styles: { width: '1600px', height: '1200px' },
},
};

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
viewport: {
viewports: {
...INITIAL_VIEWPORTS,
...customViewports,
},
},
msw: handlers,
};

const preview: Preview = { parameters };

export default preview;
4 changes: 4 additions & 0 deletions docs/REQUIREMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 요구 사항

- [x] 사용자는 여러 서버 중 하나를 선택할 수 있다.
- [x] 사용자 별 장바구니 기능이 정상적으로 동작하게 만든다.
Loading