-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(storybook): button,link,global,less-var * chore(storybook): change content Co-authored-by: zhujiahong <zhujiahong@growingio.com>
- Loading branch information
Showing
127 changed files
with
801 additions
and
310 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
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
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
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 |
---|---|---|
@@ -1,30 +1,156 @@ | ||
import React from 'react'; | ||
import { Story, Meta } from '@storybook/react/types-6-0'; | ||
import { PlusCircleFilled, FilterOutlined, DeleteOutlined } from '@gio-design/icons'; | ||
import { PlusOutlined, FilterOutlined } from '@gio-design/icons'; | ||
import { withDesign } from 'storybook-addon-designs'; | ||
import Button from '../index'; | ||
import IconButton from '../IconButton'; | ||
import { ButtonProps, IconButtonProps } from '../interface'; | ||
import '../style'; | ||
import './index.less'; | ||
import Docs from './ButtonPage'; | ||
|
||
export default { | ||
title: 'Upgraded/Button', | ||
component: Button, | ||
argTypes: { | ||
prefix: { | ||
control: { type: 'text' }, // 不约束react_node会传入对象导致报错 | ||
}, | ||
suffix: { | ||
control: { type: 'text' }, | ||
}, | ||
}, | ||
decorators: [withDesign], | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/J2wZWEocPEb1DbDEj99AgD/Design-System?node-id=373%3A15923', | ||
allowFullscreen: true, | ||
}, | ||
docs: { | ||
page: Docs, | ||
}, | ||
}, | ||
} as Meta; | ||
const Context = [ | ||
{ type: 'primary', children: '主要按钮' }, | ||
{ type: 'secondary', children: '次要按钮' }, | ||
{ type: 'text', children: '文字按钮' }, | ||
]; | ||
|
||
const Template: Story<ButtonProps> = (args) => ( | ||
<Button {...args} suffix={<FilterOutlined />} prefix={<PlusCircleFilled />} /> | ||
<table> | ||
<tr> | ||
<th>Button Control</th> | ||
<th>描述</th> | ||
{Context.map((item) => ( | ||
<th>{item.type}</th> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Size</td> | ||
<td>拥有两种尺寸:大号为高度36px,小号为高度30px</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} size="normal" type={item.type} /> | ||
<Button {...args} size="small" type={item.type} /> | ||
</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Prefix Only</td> | ||
<td>按钮是否只有前缀</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} prefix={<PlusOutlined />} type={item.type} /> | ||
</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Suffix Only</td> | ||
<td>按钮是否只有后缀</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} suffix={<FilterOutlined />} type={item.type} /> | ||
</td> | ||
))} | ||
</tr> | ||
|
||
<tr> | ||
<td>Loading</td> | ||
<td>加载样式</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} type={item.type} loading /> | ||
<Button {...args} size="small" type={item.type} loading /> | ||
</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Icon Only</td> | ||
<td>按钮是否只有icon</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<IconButton {...args} type={item.type}> | ||
<FilterOutlined /> | ||
</IconButton> | ||
<IconButton {...args} size="small" type={item.type}> | ||
<FilterOutlined /> | ||
</IconButton> | ||
</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Disabled</td> | ||
<td>disabled状态的样式</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} disabled type={item.type} /> | ||
</td> | ||
))} | ||
</tr> | ||
<tr> | ||
<td>Prefix+Suffix</td> | ||
<td>前缀和后缀都存在</td> | ||
{Context.map((item: any) => ( | ||
<td> | ||
<Button {...args} suffix={<FilterOutlined />} prefix={<PlusOutlined />} type={item.type} /> | ||
</td> | ||
))} | ||
</tr> | ||
</table> | ||
); | ||
|
||
export const Default = Template.bind({}); | ||
export const Demo = Template.bind({}); | ||
Demo.args = { | ||
children: 'Button', | ||
}; | ||
|
||
const ButtonTemplate: Story<ButtonProps> = (args) => <Button {...args} />; | ||
export const Default = ButtonTemplate.bind({}); | ||
|
||
Default.args = { | ||
children: 'Button', | ||
prefix: <PlusOutlined />, | ||
}; | ||
export const Disable = ButtonTemplate.bind({}); | ||
Disable.args = { | ||
children: 'Disable', | ||
disabled: true, | ||
}; | ||
|
||
const IconButtonTemplate: Story<IconButtonProps> = (args) => ( | ||
<IconButton {...args}> | ||
<DeleteOutlined /> | ||
<FilterOutlined /> | ||
</IconButton> | ||
); | ||
|
||
export const IconButtonDemo = IconButtonTemplate.bind({}); | ||
IconButtonDemo.args = {}; | ||
|
||
export const BlockButton = ButtonTemplate.bind({}); | ||
BlockButton.args = { | ||
children: 'Block', | ||
style: { | ||
width: '100%', | ||
}, | ||
}; |
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,17 @@ | ||
table { | ||
border-spacing: 0; | ||
th { | ||
padding: 10px; | ||
font-size: 14px; | ||
text-align: left; | ||
background-color: #f7f8fc; | ||
} | ||
td { | ||
padding: 5px 5px; | ||
font-size: 14px; | ||
border: 1px solid #f7f8fc; | ||
.gio-button { | ||
margin: 4px 8px; | ||
} | ||
} | ||
} |
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.
30ab729
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: