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

chat main component (after #4 merged) #6

Open
wants to merge 28 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c104852
[#3] chore: swc 설정
jiyong1 Dec 1, 2021
833de9d
[#3] chore: storybook, chromatic 패키지 추가
jiyong1 Dec 3, 2021
4f95645
[#3] chore: webpack 설정 변경 및 필요없는 패키지 제거
jiyong1 Dec 3, 2021
b513be8
[#3] chore: storybook 환경 설정
jiyong1 Dec 3, 2021
360230f
[#3] feature: feedback item & list component 추가
jiyong1 Dec 3, 2021
55cde3e
[#3] feature: feedback item & list component story 추가
jiyong1 Dec 3, 2021
7e790e6
[#3] chore: chromatic github action setup
jiyong1 Dec 3, 2021
b9c3d12
[#5] chore: TellbyChatClient컴포넌트 TelbbyChat으로 이름 변경
jiyong1 Dec 6, 2021
4488deb
[#3] refactor: style, tag name 변경 & feedback props 변경
jiyong1 Dec 7, 2021
279daf3
Merge branch 'feature/#3' of https://github.com/telbby/telbby-chat in…
jiyong1 Dec 7, 2021
9e611fc
[#5] feature: x 버튼, 뒤로가기 버튼 컴포넌트
jiyong1 Dec 7, 2021
6b2d879
[#5] feature: chat main component 초안
jiyong1 Dec 7, 2021
5831d1f
[#5] style: primary에 따른 theme 분리
jiyong1 Dec 9, 2021
40c677a
[#5] refactor: theme 분리에 따른 코드 수정
jiyong1 Dec 9, 2021
9da58fc
[#3] refactor: project type을 root type(@types)에서 type 디렉토리로 변경
jiyong1 Dec 18, 2021
ec9221f
[#3] refactor: FeedbackItem을 FeedbackListItem으로 이름 변경
jiyong1 Dec 18, 2021
eb68302
[#3] refactor: FeedbackList css속성을 함수로 변경
jiyong1 Dec 18, 2021
8d3579b
Merge pull request #4 from telbby/feature/#3
jiyong1 Dec 23, 2021
6d756fa
[#5] chore: TellbyChatClient컴포넌트 TelbbyChat으로 이름 변경
jiyong1 Dec 6, 2021
79950c9
[#5] feature: x 버튼, 뒤로가기 버튼 컴포넌트
jiyong1 Dec 7, 2021
bc60a6c
[#5] feature: chat main component 초안
jiyong1 Dec 7, 2021
be31e2a
[#5] style: primary에 따른 theme 분리
jiyong1 Dec 9, 2021
8e6b36f
[#5] refactor: theme 분리에 따른 코드 수정
jiyong1 Dec 9, 2021
b0599e9
[#5] refactor: lint props spreading을 허용해주고 그 방식으로 수정
jiyong1 Dec 23, 2021
faad7e5
[#5] chore: #3 merge conflict 해결
jiyong1 Dec 23, 2021
c8399a8
[#5] refactor: 각 theme에 defaultTheme을 spread 하는 방식으로 수정
jiyong1 Dec 27, 2021
7a8e45b
[#5] refactor: type directory import 변경 & totalFeedbackCount로 name 변경…
jiyong1 Dec 27, 2021
c50588d
[#5] style: main logo image border와 background 추가
jiyong1 Dec 27, 2021
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
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
1,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
'react/jsx-props-no-spreading': 'off',
'no-param-reassign': [
'error',
{ props: true, ignorePropertyModificationsForRegex: ['^draft'] },
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Storybook Deployment'

# Event for the workflow
on: push

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: yarn
- uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GH_TOKEN }}
25 changes: 25 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const custom = require('../config/webpack/webpack.common');

module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
framework: '@storybook/react',
core: {
builder: 'webpack5',
},
webpackFinal: async (config) => {
const {
module: { rules },
resolve: { alias },
} = custom;

return {
...config,
module: { ...config.module, rules },
resolve: {
...config.resolve,
alias,
},
};
},
};
26 changes: 26 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { RecoilRoot } from 'recoil';
import { ThemeProvider } from '@emotion/react';
import GlobalStyle from '../src/styles/GlobalStyle';

import { primaryTheme } from '../src/styles/theme';

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

export const decorators = [
(Story) => (
<RecoilRoot>
<ThemeProvider theme={primaryTheme}>
<GlobalStyle />
<Story />
</ThemeProvider>
</RecoilRoot>
),
];
23 changes: 23 additions & 0 deletions config/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"jsc": {
"transform": {
"react": {
"runtime": "automatic",
"throwIfNamespace": true,
"importSource": "@emotion/react"
}
},
"parser": {
"syntax": "typescript",
"tsx": true,
"decorators": false,
"dynamicImport": false
}
},
"env": {
"targets": ">= 1%, not dead",
"mode": "usage",
"coreJs": 3
},
"minify": true
}
33 changes: 0 additions & 33 deletions config/babel.config.json

This file was deleted.

7 changes: 5 additions & 2 deletions config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const fs = require('fs');

const swcConfig = JSON.parse(fs.readFileSync(`${__dirname}/.swcrc`, 'utf-8'));

module.exports = {
rootDir: '../',
testEnvironment: 'jsdom',
Expand All @@ -7,8 +11,7 @@ module.exports = {
transform: {
'.+\\.(svg|css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+\\.(js|jsx)?$': 'babel-jest',
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(j|t)sx?$': ['@swc/jest', { ...swcConfig }],
},
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
};
3 changes: 2 additions & 1 deletion config/webpack/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ const resolveModule = (resolveFn, filePath) => {

module.exports = {
appPath: resolveApp('.'),
appSource: resolveApp('src'),
appIndex: resolveModule(resolveApp, './src/index'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
babelConfig: resolveApp('config/babel.config.json'),
swcConfig: resolveApp('config/.swcrc'),
publicUrlOrPath,
};
14 changes: 5 additions & 9 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,9 @@ module.exports = {
test: /\.(js|jsx|ts|tsx)$/,
use: [
{
loader: 'babel-loader',
loader: 'swc-loader',
options: {
babelrc: true,
configFile: paths.babelConfig,
},
},
{
loader: 'ts-loader',
options: {
transpileOnly: true,
configFile: paths.swcConfig,
},
},
],
Expand Down Expand Up @@ -89,5 +82,8 @@ module.exports = {
],
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
alias: {
'@': paths.appSource,
},
},
};
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@
"precommit": "yarn lint-staged --config ./config/lintstagedrc.json",
"test": "jest --config ./config/jest.config.js",
"test:watch": "jest --watchAll --config ./config/jest.config.js",
"test:coverage": "jest --coverage --config ./config/jest.config.js"
"test:coverage": "jest --coverage --config ./config/jest.config.js",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"devDependencies": {
"@babel/core": "^7.15.8",
"@babel/plugin-transform-runtime": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@babel/runtime-corejs3": "^7.15.4",
"@emotion/babel-plugin": "^11.3.0",
"@storybook/addon-actions": "^6.4.4",
"@storybook/addon-essentials": "^6.4.4",
"@storybook/addon-links": "^6.4.4",
"@storybook/builder-webpack5": "^6.4.4",
"@storybook/manager-webpack5": "^6.4.4",
"@storybook/react": "^6.4.4",
"@swc/core": "^1.2.115",
"@swc/jest": "^0.2.11",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.1.2",
"@types/jest": "^27.0.2",
Expand All @@ -33,10 +36,8 @@
"@types/react-router-dom": "^5.3.1",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"babel-jest": "^27.3.0",
"babel-loader": "^8.2.2",
"babel-plugin-root-import": "^6.6.0",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
"chromatic": "^6.1.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^9.0.1",
"css-loader": "^6.4.0",
Expand All @@ -63,8 +64,7 @@
"prettier": "^2.4.1",
"style-loader": "^3.3.0",
"svg-url-loader": "^7.1.1",
"ts-jest": "^27.0.7",
"ts-loader": "^9.2.6",
"swc-loader": "^0.1.15",
"typescript": "^4.4.4",
"url-loader": "^4.1.1",
"webpack": "^5.56.0",
Expand All @@ -73,7 +73,6 @@
"webpack-merge": "^5.8.0"
},
"dependencies": {
"@babel/runtime": "^7.15.4",
"@emotion/react": "^11.5.0",
"core-js": "3",
"react": "^17.0.2",
Expand Down
4 changes: 4 additions & 0 deletions src/@types/image.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.png' {
const value: string;
export default value;
}
20 changes: 18 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import React, { FC } from 'react';
import { BrowserRouter } from 'react-router-dom';
import { RecoilRoot } from 'recoil';
import { ThemeProvider } from '@emotion/react';

import TelbbyServiceClient from './components/TelbbyServiceClient';
import { primaryTheme, subTheme } from './styles/theme';
import GlobalStyle from './styles/GlobalStyle';
import TelbbyChat from './components/TelbbyChat';

const App: FC = () => {
return <TelbbyServiceClient />;
// @TODO: primary 정보를 가져와 어떤 theme을 전달할지 결정해야 합니다.
const isPrimary = true;
return (
<BrowserRouter>
<RecoilRoot>
<ThemeProvider theme={isPrimary ? primaryTheme : subTheme}>
Comment on lines +11 to +16
Copy link
Member

Choose a reason for hiding this comment

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

ThemeProvider 좋네용 !!! 👍🏻👍🏻👍🏻

<GlobalStyle />
<TelbbyChat />
</ThemeProvider>
</RecoilRoot>
</BrowserRouter>
);
};

export default App;
26 changes: 26 additions & 0 deletions src/components/Main/BottomButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { FC } from 'react';

import {
mainBottomSectionStyle,
mainBottomButtonWrapperStyle,
mainBottomButtonStyle,
} from './style';

const BottomButton: FC = () => {
// @TODO: 버튼 클릭시 채팅 컴포넌트로 넘어가도록 해야합니다.

return (
<div css={mainBottomSectionStyle}>
<div css={mainBottomButtonWrapperStyle}>
<p>
나도 프로젝트 피드백 남기고 <br /> 베스트 리뷰어 되기
</p>
<button css={mainBottomButtonStyle} type="button">
GO
</button>
</div>
</div>
);
};

export default BottomButton;
30 changes: 30 additions & 0 deletions src/components/Main/Nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { FC } from 'react';
import { useTheme } from '@emotion/react';

import ExitBtn from '@/components/common/ExitBtn';

import { mainNavStyle } from './style';

type NavProps = {
handleExit: () => void;
image: string;
name: string;
};

const Nav: FC<NavProps> = ({ handleExit, image, name }) => {
const theme = useTheme();

return (
<nav css={mainNavStyle}>
<img src={image} alt={`${name} logo`} />
<ExitBtn
width="14px"
height="14px"
color={theme.colorReverse}
onClick={handleExit}
/>
</nav>
);
};

export default Nav;
41 changes: 41 additions & 0 deletions src/components/Main/PresentationalMain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { FC } from 'react';

import { chatMainWrapperStyle } from './style';
import Nav from './Nav';
import ProjectIntro from './ProjectIntro';
import BottomButton from './BottomButton';
import FeedbackList from '@/components/feedback/FeedbackList';

import type { Project } from '@/types/project';

type PresentationalMainProps = {
project: Project;
handleExit: () => void;
};

const PresentationalMain: FC<PresentationalMainProps> = ({
project,
handleExit,
}) => {
const {
name,
image,
description,
feedbackList: feedbacks,
totalFeedbackCount,
} = project;

return (
<div css={chatMainWrapperStyle}>
<Nav name={name} image={image} handleExit={handleExit} />
<ProjectIntro name={name} description={description} />
<FeedbackList
feedbacks={feedbacks}
totalFeedbackCount={totalFeedbackCount}
/>
<BottomButton />
</div>
);
};

export default PresentationalMain;
Loading