Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyugeon committed Jan 20, 2024
2 parents e961b8b + dfc0ec0 commit faf5b9e
Show file tree
Hide file tree
Showing 23 changed files with 1,022 additions and 80 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
- name: Install Dependency
run: yarn install --immutable

- name: Set .env
run: echo "${{ vars.DEVELOPMENT_ENV }}" > .env.local

- name: Publish Chromatic
id: chromatic
uses: chromaui/action@v1
Expand Down
51 changes: 44 additions & 7 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
import React from 'react';

import { rest } from 'msw';
import { initialize, mswLoader } from 'msw-storybook-addon';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import type { Preview } from '@storybook/react';
import '@/styles/global.css';

import Layout from '../src/v1/layout/Layout';
import ToastProvider from '../src/v1/base/Toast/ToastProvider';

import '@/styles/global.css';

const nextApi = (path: string) =>
new URL(path, process.env.NEXT_HOST).toString();

const serviceApi = (path: string) =>
new URL(path, process.env.NEXT_PUBLIC_API_URL).toString();

initialize({}, [
rest.get(nextApi('/service-api/*'), async (req, res, ctx) => {
const { pathname } = req.url;
const match = /\/service-api(?<path>.*)/g.exec(pathname);

if (!match || !match.groups || !match.groups.path) {
return res(ctx.status(404, 'Invalid Request URL'));
}

const { path } = match.groups;
const originResponse = await ctx.fetch(serviceApi(`/api${path}`));
const originResponseData = await originResponse.json();

return res(ctx.json({ ...originResponseData }));
}),
]);

const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
},
},
});

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand All @@ -20,13 +54,16 @@ const preview: Preview = {
},
layout: 'fullscreen',
},
loaders: [mswLoader],
decorators: [
Story => (
<ToastProvider>
<Layout>
<Story />
</Layout>
</ToastProvider>
<QueryClientProvider client={queryClient}>
<ToastProvider>
<Layout>
<Story />
</Layout>
</ToastProvider>
</QueryClientProvider>
),
],
};
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"less": "^4.1.3",
"less-loader": "^11.1.3",
"lint-staged": "^13.1.1",
"msw": "1.3.2",
"msw-storybook-addon": "^1.10.0",
"postcss": "^8.4.25",
"prettier": "^2.8.4",
"prettier-plugin-tailwindcss": "^0.3.0",
Expand All @@ -70,5 +72,8 @@
]
},
"readme": "ERROR: No README data found!",
"_id": "[email protected]"
"_id": "[email protected]",
"msw": {
"workerDirectory": "public"
}
}
3 changes: 3 additions & 0 deletions public/icons/book-plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/icons/delete.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/icons/hamburger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export { default as IconComments } from './comments.svg';
export { default as IconDelete } from './delete.svg';
export { default as IconMembers } from './members.svg';
export { default as IconPlus } from './plus.svg';
export { default as IconBookPlus } from './book-plus.svg';

// 카카오
export { default as IconKakao } from './kakao.svg';
Loading

0 comments on commit faf5b9e

Please sign in to comment.