This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fan-mengwen
committed
Jun 5, 2023
1 parent
44b22a2
commit 59929e7
Showing
25 changed files
with
390 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { Alert } from '../src'; | ||
import { Alert as BsAlert } from '../src'; | ||
import { AlertProps } from '../src/interface'; | ||
|
||
storiesOf('Alert', module) | ||
.add('error', () => ( | ||
<div> | ||
<h3>对齐方式</h3> | ||
<p>居左对齐</p> | ||
<Alert bsStyle="error" showIcon> | ||
这里是 error 级别 | ||
</Alert> | ||
<p>居中对齐</p> | ||
<Alert bsStyle="error" textAlign='center' showIcon> | ||
这里是 error 级别 | ||
</Alert> | ||
<p>内置提示</p> | ||
<Alert bsStyle="error" textAlign='inline' showIcon> | ||
这里是 error 级别 | ||
</Alert> | ||
<h3>关闭功能</h3> | ||
<Alert bsStyle="error" showIcon dismissDirection="right" onDismiss={() =>{}}> | ||
这里是 error 级别 <a href="#">点击操作</a> | ||
</Alert> | ||
</div> | ||
)) | ||
.add('info', () => ( | ||
<Alert bsStyle="info" showIcon> | ||
这里是 info 级别 <a href="#">点击操作</a> | ||
</Alert> | ||
const STATUS = ['warning', 'info', 'error']; | ||
const Alert = (props: Partial<AlertProps>) => { | ||
return ( | ||
<> | ||
{STATUS.map(variant => ( | ||
<BsAlert bsStyle={variant as AlertProps['bsStyle']} {...props}> | ||
This is a {variant} alert! | ||
</BsAlert> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
storiesOf('DATA SHOW | Alert', module) | ||
.add('default', () => <Alert />) | ||
.add('icon', () => <Alert showIcon />) | ||
.add('align', () => ( | ||
<> | ||
<p> | ||
<h3>left</h3> | ||
<Alert textAlign="left" showIcon /> | ||
</p> | ||
<p> | ||
<h3>center</h3> | ||
<Alert textAlign="center" showIcon /> | ||
</p> | ||
<p> | ||
<h3>inline</h3> | ||
<Alert textAlign="inline" showIcon /> | ||
</p> | ||
</> | ||
)) | ||
.add('warning', () => ( | ||
<Alert bsStyle="warning"> | ||
这里是 warning 级别 <a href="#">点击操作</a> | ||
</Alert> | ||
.add('operation', () => ( | ||
<> | ||
<Alert bsStyle="warning" showIcon dismissDirection="right" onDismiss={() => {}}> | ||
This is a warning alert with close and click! | ||
<a href="#" style={{ paddingLeft: 8 }}> | ||
click here | ||
</a> | ||
</Alert> | ||
</> | ||
)); |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { Nav } from '../src'; | ||
|
||
storiesOf('Components | Nav', module).add('tabs', () => { | ||
const monitorTabs = [ | ||
{ | ||
title: '用户业务', | ||
key: 'users', | ||
}, | ||
{ | ||
title: '复制', | ||
key: 'copy', | ||
}, | ||
{ | ||
title: '生命周期', | ||
key: 'flow', | ||
}, | ||
]; | ||
return ( | ||
<div> | ||
<Nav | ||
variant="tabs" | ||
defaultActiveKey="users" | ||
onSelect={selectedKey => alert(`selected ${selectedKey}`)} | ||
> | ||
{monitorTabs.map(tab => { | ||
return ( | ||
<Nav.Item> | ||
<Nav.Link eventKey={tab.key}>{tab.title}</Nav.Link> | ||
</Nav.Item> | ||
); | ||
})} | ||
</Nav> | ||
</div> | ||
); | ||
}); |
Oops, something went wrong.