mirror of https://github.com/msgbyte/tailchat
feat: 增加storybook
parent
f22aa794aa
commit
91c98870da
@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
stories: [
|
||||
'../components/**/*.stories.mdx',
|
||||
'../components/**/*.stories.@(js|jsx|ts|tsx)',
|
||||
],
|
||||
addons: [
|
||||
'@storybook/addon-links',
|
||||
'@storybook/addon-essentials',
|
||||
'@storybook/addon-interactions',
|
||||
],
|
||||
framework: '@storybook/react',
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
import 'antd/dist/antd.css';
|
||||
|
||||
export const parameters = {
|
||||
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
};
|
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
|
||||
import { DelayTip } from '.';
|
||||
|
||||
export default {
|
||||
title: 'Tailchat/DelayTip',
|
||||
component: DelayTip,
|
||||
argTypes: {},
|
||||
} as ComponentMeta<typeof DelayTip>;
|
||||
|
||||
const Template: ComponentStory<typeof DelayTip> = (args) => (
|
||||
<DelayTip {...args}>鼠标移动到这里等待1s</DelayTip>
|
||||
);
|
||||
|
||||
export const Default = Template.bind({});
|
||||
Default.args = {
|
||||
title: 'Hello World',
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
import React from 'react';
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
|
||||
import { Image } from '.';
|
||||
|
||||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
||||
export default {
|
||||
title: 'Tailchat/Image',
|
||||
component: Image,
|
||||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
||||
argTypes: {},
|
||||
} as ComponentMeta<typeof Image>;
|
||||
|
||||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
||||
const Template: ComponentStory<typeof Image> = (args) => (
|
||||
<>
|
||||
<Image
|
||||
src={'https://source.unsplash.com/collection/94734566/1920x1080'}
|
||||
{...args}
|
||||
/>
|
||||
<div>一个简单的图片, 自带Fallback机制</div>
|
||||
</>
|
||||
);
|
||||
|
||||
export const Default = Template.bind({});
|
||||
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
||||
Default.args = {
|
||||
preview: true,
|
||||
width: 640,
|
||||
height: 360,
|
||||
};
|
||||
|
||||
export const Fallback = Template.bind({});
|
||||
// More on args: https://storybook.js.org/docs/react/writing-stories/args
|
||||
Fallback.args = {
|
||||
src: '',
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
<Meta title="Tailchat/Introduction" />
|
||||
|
||||
# Tailchat Design
|
||||
|
||||
Tailchat Design 是 msgbyte 专为 Tailchat 打造的一套设计样式,基于 `antd` 之上做了一层封装
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue