Skip to content

Commit

Permalink
add custom icon demo for Toast
Browse files Browse the repository at this point in the history
  • Loading branch information
warmhug authored and lixiaoyang1992 committed Apr 26, 2018
1 parent c5ae858 commit 7c39441
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions components/toast/__tests__/__snapshots__/demo.test.web.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ exports[`renders ./components/toast/demo/basic.md correctly 1`] = `
<div
class="am-whitespace am-whitespace-md"
/>
<a
aria-disabled="false"
class="am-button"
role="button"
>
<span>
Cumstom Icon
</span>
</a>
<div
class="am-whitespace am-whitespace-md"
/>
<a
aria-disabled="false"
class="am-button"
Expand Down
8 changes: 6 additions & 2 deletions components/toast/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title:
text、icon、success、failure、offline、loading

````jsx
import { Toast, WhiteSpace, WingBlank, Button } from 'antd-mobile';
import { Toast, WhiteSpace, WingBlank, Button, Icon } from 'antd-mobile';

function showToast() {
Toast.info('This is a toast tips !!!', 1);
Expand All @@ -35,14 +35,18 @@ function loadingToast() {
console.log('Load complete !!!');
});
}

/* eslint global-require: 0 */
const ToastExample = () => (
<WingBlank>
<WhiteSpace />
<Button onClick={showToast}>Text toast</Button>
<WhiteSpace />
<Button onClick={showToastNoMask}>Without mask</Button>
<WhiteSpace />
<Button onClick={() => Toast.info(<Icon type={require('./reload.svg')} />, 1)}>
Cumstom Icon
</Button>
<WhiteSpace />
<Button onClick={successToast}>Success toast</Button>
<WhiteSpace />
<Button onClick={failToast}>Failed toast</Button>
Expand Down
1 change: 1 addition & 0 deletions components/toast/demo/reload.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions svg.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (config, includeDemo) => {
path.resolve(__dirname, 'components/action-sheet/demo/'),
path.resolve(__dirname, 'components/result/demo/'),
path.resolve(__dirname, 'components/menu/demo/'),
path.resolve(__dirname, 'components/toast/demo/'),
]);
}
// Can not process SVG files twice
Expand Down

0 comments on commit 7c39441

Please sign in to comment.