-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
39 changed files
with
205 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import type { StorybookConfig } from "@storybook/react-webpack5"; | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
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", | ||
"@storybook/addon-styling-webpack" | ||
'@storybook/preset-create-react-app', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
'@storybook/addon-styling-webpack', | ||
], | ||
framework: { | ||
name: "@storybook/react-webpack5", | ||
name: '@storybook/react-webpack5', | ||
options: {}, | ||
}, | ||
staticDirs: ["../public"], | ||
staticDirs: ['../public'], | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import type { Preview } from "@storybook/react"; | ||
import "../src/stories/tailwind.css"; | ||
import type { Preview } from '@storybook/react'; | ||
import './tailwind.css'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
type Domain = "auth" | "users" | "quizs" | "accounts" | "promises" | "missions"; | ||
type Domain = 'auth' | 'users' | 'quizs' | 'accounts' | 'promises' | 'missions'; | ||
|
||
/** 도메인 맵핑 객체 | ||
* | ||
* API 명세가 합의되면 하위 엔드포인트도 추가로 만들어서 타이핑 | ||
*/ | ||
const REQUEST_DOMAINS: Record<Domain, Domain> = { | ||
auth: "auth", | ||
users: "users", | ||
quizs: "quizs", | ||
accounts: "accounts", | ||
promises: "promises", | ||
missions: "missions", | ||
auth: 'auth', | ||
users: 'users', | ||
quizs: 'quizs', | ||
accounts: 'accounts', | ||
promises: 'promises', | ||
missions: 'missions', | ||
}; | ||
|
||
export default REQUEST_DOMAINS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import REQUEST_DOMAINS from './axiosConfig'; | ||
import { showToast } from '../utils/toastUtil'; | ||
import { api } from './interceptors'; | ||
import { IExampleResponse } from '../interfaces/exampleInterface'; | ||
|
||
// ============= Example Test ====================== | ||
export const getExample1 = () => { | ||
return api({ | ||
url: `${REQUEST_DOMAINS.auth}/examples`, | ||
method: 'get', | ||
}); | ||
}; | ||
|
||
export const getExample2 = () => { | ||
return api.get<IExampleResponse>(`${REQUEST_DOMAINS.auth}/examples`); | ||
}; | ||
|
||
export const getExamples = async (): Promise<IExampleResponse> => { | ||
try { | ||
const response = await api.get<IExampleResponse>( | ||
`${REQUEST_DOMAINS.auth}/examples`, | ||
); | ||
showToast('success', '성공 메시지 띄우기'); | ||
|
||
return response.data; | ||
} catch (error) { | ||
console.error('Error:', error); | ||
showToast('error', '실패 에러 메시지 띄우기'); | ||
throw new Error(`나중에 에러 토스트에 띄울 메시지로 재가공해서 내보내기`); | ||
} | ||
}; | ||
// ============= Example Test ====================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { atom } from "recoil"; | ||
import { atom } from 'recoil'; | ||
|
||
export const exampleState = atom({ | ||
key: "exampleState", | ||
key: 'exampleState', | ||
default: { | ||
exampleKey: "exampleValue", | ||
exampleKey: 'exampleValue', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Button } from './index'; | ||
|
||
const meta = { | ||
component: Button, | ||
argTypes: { | ||
children: { | ||
description: '버튼 안에 표시할 텍스트', | ||
}, | ||
fullWidth: { | ||
description: '버튼의 스타일', | ||
}, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: 'Button', | ||
fullWidth: true, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// ========== Example Test ========== | ||
export interface IExample { | ||
// 스켈레톤 테스트용입니다. | ||
id: number; | ||
name: string; | ||
number: number; | ||
} | ||
|
||
export interface IExampleResponse { | ||
// 스켈레톤 테스트용입니다. | ||
examples: IExample[]; | ||
} | ||
// ========== Example Test ========== |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
import AxiosMockAdapter from 'axios-mock-adapter'; | ||
import { api } from '../apis/interceptors'; | ||
import REQUEST_DOMAINS from '../apis/axiosConfig'; | ||
|
||
export const mock = new AxiosMockAdapter(api); | ||
|
||
// 핸들러 파일들 로드 | ||
require('./userHandler'); | ||
require('./exampleHandler'); | ||
// ========== Test Domain ========== | ||
mock.onPost(`/${REQUEST_DOMAINS.auth}/users`).reply(200, { | ||
users: [{ id: 1, name: 'John Smith' }], | ||
}); | ||
|
||
mock.onGet(`/${REQUEST_DOMAINS.auth}/examples`).reply(() => { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve([ | ||
200, | ||
{ | ||
examples: [ | ||
{ id: 1, name: '스켈레톤 테스트용 1', number: 100 }, | ||
{ id: 2, name: '스켈레톤 테스트용 2', number: 200 }, | ||
{ id: 3, name: '스켈레톤 테스트용 3', number: 300 }, | ||
], | ||
}, | ||
]); | ||
}, 500); | ||
}); | ||
}); | ||
// ========== Test Domain ========== |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.