mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 11:49:04 +08:00
Feat(UI): Storybook is added (#456)
* feat(storybook): storybook is added * spinner story is added * package.json is updated
This commit is contained in:
parent
1ab291f3e8
commit
b27e30db58
11
frontend/.storybook/main.js
Normal file
11
frontend/.storybook/main.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
"stories": [
|
||||||
|
"../src/**/*.stories.mdx",
|
||||||
|
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
||||||
|
],
|
||||||
|
"addons": [
|
||||||
|
"@storybook/addon-links",
|
||||||
|
"@storybook/addon-essentials"
|
||||||
|
],
|
||||||
|
"framework": "@storybook/react"
|
||||||
|
}
|
11
frontend/.storybook/preview.js
Normal file
11
frontend/.storybook/preview.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import '../public/css/antd.min.css';
|
||||||
|
|
||||||
|
export const parameters = {
|
||||||
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||||
|
controls: {
|
||||||
|
matchers: {
|
||||||
|
color: /(background|color)$/i,
|
||||||
|
date: /Date$/,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
@ -14,7 +14,9 @@
|
|||||||
"jest": "jest",
|
"jest": "jest",
|
||||||
"jest:coverage": "jest --coverage",
|
"jest:coverage": "jest --coverage",
|
||||||
"jest:watch": "jest --watch",
|
"jest:watch": "jest --watch",
|
||||||
"bundle:size": "bundlesize"
|
"bundle:size": "bundlesize",
|
||||||
|
"storybook": "start-storybook -p 6006",
|
||||||
|
"build-storybook": "build-storybook"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.13.0"
|
"node": ">=12.13.0"
|
||||||
@ -88,6 +90,11 @@
|
|||||||
"@babel/preset-env": "^7.12.17",
|
"@babel/preset-env": "^7.12.17",
|
||||||
"@babel/preset-react": "^7.12.13",
|
"@babel/preset-react": "^7.12.13",
|
||||||
"@babel/preset-typescript": "^7.12.17",
|
"@babel/preset-typescript": "^7.12.17",
|
||||||
|
"@storybook/addon-actions": "^6.4.7",
|
||||||
|
"@storybook/addon-essentials": "^6.4.7",
|
||||||
|
"@storybook/addon-links": "^6.4.7",
|
||||||
|
"@storybook/cli": "^6.4.7",
|
||||||
|
"@storybook/react": "^6.4.7",
|
||||||
"@testing-library/cypress": "^8.0.0",
|
"@testing-library/cypress": "^8.0.0",
|
||||||
"@types/compression-webpack-plugin": "^9.0.0",
|
"@types/compression-webpack-plugin": "^9.0.0",
|
||||||
"@types/copy-webpack-plugin": "^8.0.1",
|
"@types/copy-webpack-plugin": "^8.0.1",
|
||||||
|
21
frontend/src/stories/Spinner.stories.tsx
Normal file
21
frontend/src/stories/Spinner.stories.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import Spinner from '../components/Spinner';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Components/Common',
|
||||||
|
component: Spinner,
|
||||||
|
} as ComponentMeta<typeof Spinner>;
|
||||||
|
|
||||||
|
const Template: ComponentStory<typeof Spinner> = (args) => (
|
||||||
|
<Spinner {...args} />
|
||||||
|
);
|
||||||
|
|
||||||
|
export const DefaultSpinner = Template.bind({});
|
||||||
|
|
||||||
|
DefaultSpinner.args = {
|
||||||
|
tip: 'Loading...',
|
||||||
|
size: 'default',
|
||||||
|
height: '40vh',
|
||||||
|
};
|
5407
frontend/yarn.lock
5407
frontend/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user