Skip to content
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
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["next/core-web-vitals", "prettier", "plugin:storybook/recommended"]
}
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.12.1
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": true,
"printWidth": 100
}
13 changes: 13 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/preset-scss',
],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-webpack5',
},
};
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,17 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

## ディレクトリ構成

- 参考記事
- SPA Component の推しディレクトリ構成について語る
- https://zenn.dev/yoshiko/articles/99f8047555f700
- https://github.com/yoshiko-pg/next-template
- https://zenn.dev/brachio_takumi/articles/2ab9ef9fbe4159

## コンポーネント設計

- 参考記事
- 経年劣化に耐える ReactComponent の書き方
- https://zenn.dev/takepepe/articles/howto-withstand-aging-react-component
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions jest.config.storyshots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const nextJest = require('next/jest');

const createJestConfig = nextJest({
dir: './',
});

const customJestConfig = {
displayName: 'storyshots',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1', // tsconfig.jsonのcompilerOptions>pathsの定義に合わせてください
},
testEnvironment: 'jest-environment-jsdom',
testMatch: ['<rootDir>/jest.storyshots.ts'],
};

module.exports = createJestConfig(customJestConfig);
16 changes: 16 additions & 0 deletions jest.config.storyshotsImage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const nextJest = require('next/jest');

const createJestConfig = nextJest({
dir: './',
});

const customJestConfig = {
displayName: 'storyshots',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1', // tsconfig.jsonのcompilerOptions>pathsの定義に合わせる
},
testEnvironment: 'jest-environment-jsdom',
testMatch: ['<rootDir>/jest.storyshotsImage.ts'],
};

module.exports = createJestConfig(customJestConfig);
5 changes: 5 additions & 0 deletions jest.storyshots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import initStoryshots, { multiSnapshotWithOptions } from '@storybook/addon-storyshots';

initStoryshots({
test: multiSnapshotWithOptions(),
});
19 changes: 19 additions & 0 deletions jest.storyshotsImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import initStoryshots from '@storybook/addon-storyshots';
import { imageSnapshot } from '@storybook/addon-storyshots-puppeteer';
import path from 'path';

initStoryshots({
test: imageSnapshot({
getMatchOptions: (options) => {
const { kind, story } = options.context;

const dir = path.resolve(__dirname, '__image_snapshots__', kind);
const name = story.replaceAll(/\s/g, '');

return {
customSnapshotsDir: path.resolve(dir),
customSnapshotIdentifier: name,
};
},
}),
});
Loading