-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up storybook for component testing
Fix issue with QuestionMark viewbox
- Loading branch information
Showing
11 changed files
with
13,807 additions
and
2,356 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,4 +1,6 @@ | ||
node_modules | ||
dist | ||
coverage | ||
tailwind.config.js | ||
tailwind.config.js | ||
postcss.config.js | ||
src/stories/**/*.stories.tsx |
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,22 @@ | ||
module.exports = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-interactions', | ||
{ | ||
name: '@storybook/addon-postcss', | ||
options: { | ||
cssLoaderOptions: { | ||
// When you have splitted your css over multiple files | ||
// and use @import('./other-styles.css') | ||
importLoaders: 1, | ||
}, | ||
postcssLoaderOptions: { | ||
implementation: require('postcss'), | ||
}, | ||
}, | ||
}, | ||
], | ||
framework: '@storybook/react', | ||
}; |
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 @@ | ||
<link href="/styles.css" rel="stylesheet" /> |
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,11 @@ | ||
import '../src/styles.css'; | ||
|
||
export const parameters = { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
} |
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 |
---|---|---|
|
@@ -8,15 +8,29 @@ | |
"react-dom": "^18" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.20.12", | ||
"@hyperlane-xyz/sdk": "1.0.0", | ||
"@mdx-js/react": "^1.6.22", | ||
"@storybook/addon-actions": "^6.5.15", | ||
"@storybook/addon-docs": "^6.5.15", | ||
"@storybook/addon-essentials": "^6.5.15", | ||
"@storybook/addon-interactions": "^6.5.15", | ||
"@storybook/addon-links": "^6.5.15", | ||
"@storybook/addon-postcss": "^2.0.0", | ||
"@storybook/builder-webpack4": "^6.5.15", | ||
"@storybook/manager-webpack4": "^6.5.15", | ||
"@storybook/react": "^6.5.15", | ||
"@storybook/testing-library": "^0.0.13", | ||
"@trivago/prettier-plugin-sort-imports": "^3.2.0", | ||
"@types/node": "^18.11.18", | ||
"@types/react": "^18.0.27", | ||
"@types/react-dom": "^18.0.10", | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "^5.27.0", | ||
"babel-loader": "^8.3.0", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"postcss": "^8.4.21", | ||
"prettier": "^2.4.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
|
@@ -27,6 +41,8 @@ | |
"files": [ | ||
"/dist" | ||
], | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"homepage": "https://www.hyperlane.xyz", | ||
"keywords": [ | ||
"Hyperlane", | ||
|
@@ -36,7 +52,6 @@ | |
"Typescript" | ||
], | ||
"license": "Apache-2.0", | ||
"main": "dist/index.js", | ||
"packageManager": "[email protected]", | ||
"repository": { | ||
"type": "git", | ||
|
@@ -48,7 +63,8 @@ | |
"build:css": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify", | ||
"clean": "rm -rf dist cache", | ||
"lint": "eslint . --ext .ts", | ||
"prettier": "prettier --write ./src" | ||
}, | ||
"types": "dist/index.d.ts" | ||
"prettier": "prettier --write ./src", | ||
"storybook": "start-storybook -p 6006", | ||
"build-storybook": "build-storybook" | ||
} | ||
} |
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,5 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
}, | ||
} |
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
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,55 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import { ChainLogo } from '../icons/ChainLogo'; | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
export default { | ||
title: 'ChainLogo', | ||
component: ChainLogo, | ||
} as ComponentMeta<typeof ChainLogo>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Template: ComponentStory<typeof ChainLogo> = (args) => <ChainLogo {...args} />; | ||
|
||
export const ColorChain = Template.bind({}); | ||
ColorChain.args = { | ||
chainId: 1, | ||
color: true, | ||
background: false, | ||
}; | ||
|
||
export const ColorNoChain = Template.bind({}); | ||
ColorNoChain.args = { | ||
chainId: 0, | ||
color: true, | ||
background: false, | ||
}; | ||
|
||
export const NoColorChain = Template.bind({}); | ||
NoColorChain.args = { | ||
chainId: 1, | ||
color: false, | ||
background: false, | ||
}; | ||
|
||
export const NoColorNoChain = Template.bind({}); | ||
NoColorNoChain.args = { | ||
chainId: 0, | ||
color: false, | ||
background: false, | ||
}; | ||
|
||
export const BackgroundColorChain = Template.bind({}); | ||
BackgroundColorChain.args = { | ||
chainId: 1, | ||
color: true, | ||
background: true, | ||
}; | ||
|
||
export const BackgroundColorNoChain = Template.bind({}); | ||
BackgroundColorNoChain.args = { | ||
chainId: 0, | ||
color: true, | ||
background: 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
Oops, something went wrong.