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

충남대 FE_박건민 1주차 과제 #96

Open
wants to merge 16 commits into
base: geonbur
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# react-gift-react-foundation

FE 카카오 선물하기 1주차 과제: React 기초

- 1단계

1. CRA로 프로젝트 생성 (Typescript 기반)
2. 절대경로를 위한 alias 설정
3. ESLint, Prettier를 추가 (Airbnb룰 적용)
4. emotion 스타일 라이브러리 추가 & reset css적용

- 2단계

- 3단계

* 질문 1. webpack은 무엇이고 어떤 역할을 하고 있나요?
웹 애플리케이션을 개발할 때 필요한 모듈 번들러입니다. 여러 개의 파일을 하나의 파일로 묶어주는 역할을 합니다.

- 하나의 파일로 묶어주는 이유?
1. 파일 크기를 줄일 수 있음(By. 압축, 난독화)
2. 모듈화 가능. 결국에는 하나로 묶이기 때문.
3. 모듈 의존성 관리 및 충돌방지 측면에서 용이함

* 질문 2. 브라우저는 어떻게 JSX 파일을 읽을 수 있나요?
Babel과 같은 트랜스파일러가 필요합니다. JSX는 자바스크립트에서 확장된 문법이 적용되기 때문입니다.

- Bable에서는 React.createElement를 활용하여 JSX를 JS파일로 변환합니다.

* 질문 3. React에서 상태 변화가 생겼을 때 어떻게 변화를 알아챌 수 있나요?
상태 초기화 (this.state) -> 상태 변경(this.setState) -> 자동으로 UI 업데이트

- 폴더구조
.storybook: Storybook 설정 파일
components
Button: Button 컴포넌트
Container: Container 컴포넌트
GoodsItem: GoodsItem 컴포넌트
Grid: Grid 컴포넌트
Image: Image 컴포넌트
Input: Input 컴포넌트
stories: 컴포넌트들의 story입력을 위한 폴더
hooks: 커스텀 훅
pages: 페이지 컴포넌트를 위해 만들어 둠
styles: 스타일, 테마 관련 파일을 위한 폴더
GlobalStyles.tsx: 전역 스타일 설정 파일
reset.css: CSS 리셋 파일
utils: 유틸리티 함수를 위해 만들어 둠
3 changes: 3 additions & 0 deletions kakao-gift-app/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/
dist/
26 changes: 26 additions & 0 deletions kakao-gift-app/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"settings": {
"react": {
"version": "detect",
},
},

"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
],
"plugins": ["prettier"],

"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": "auto",
},
],
"react/react-in-jsx-scope": "off",
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".ts", ".tsx"] }],
},
}
25 changes: 25 additions & 0 deletions kakao-gift-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

*storybook.log
3 changes: 3 additions & 0 deletions kakao-gift-app/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
build/
dist/
8 changes: 8 additions & 0 deletions kakao-gift-app/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"semi": true,
"endOfLine": "lf"
}
19 changes: 19 additions & 0 deletions kakao-gift-app/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { StorybookConfig } from '@storybook/react-webpack5';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/preset-create-react-app',
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
staticDirs: ['..\\public'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
staticDirs: ['..\\public'],
staticDirs: ['../public'],

path 인식을 하지 못해서 오류가 발생하고 있네요.

};
export default config;
14 changes: 14 additions & 0 deletions kakao-gift-app/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from '@storybook/react';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
8 changes: 8 additions & 0 deletions kakao-gift-app/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.alwaysShowStatus": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
46 changes: 46 additions & 0 deletions kakao-gift-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
3 changes: 3 additions & 0 deletions kakao-gift-app/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"]
}
Loading