Skip to content

Commit

Permalink
Merge pull request #304 from yuanmeda/fix/doc-fab413
Browse files Browse the repository at this point in the history
docs(fab): update docs ande demo
  • Loading branch information
anlyyao authored Oct 27, 2022
2 parents cf26b3d + ea1fce1 commit b7ee5a6
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
33 changes: 31 additions & 2 deletions src/fab/_example/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import React from 'react';
import React, { useState } from 'react';
import { Button } from 'tdesign-mobile-react';
import TDemoBlock from '../../../site/mobile/components/DemoBlock';
import TDemoHeader from '../../../site/mobile/components/DemoHeader';
import './style/index.less';
import BaseDemo from './display';
import TextDemo from './text';

export default function FabDemo() {
const [type, setType] = useState('base');

const changeType = (type) => setType(type);
return (
<div className="tdesign-mobile-demo">
<TDemoHeader
Expand All @@ -13,8 +18,32 @@ export default function FabDemo() {
/>

<TDemoBlock title="01 类型" summary="纯图标悬浮按钮">
<BaseDemo />
<ul className="fab-container">
<li>
<Button
className="fab-btn"
theme="primary"
variant="outline"
size="large"
onClick={() => changeType('base')}
>
基础使用
</Button>
</li>
<li>
<Button
className="fab-btn"
theme="primary"
variant="outline"
size="large"
onClick={() => changeType('advance')}
>
进阶使用
</Button>
</li>
</ul>
</TDemoBlock>
{type === 'base' ? <BaseDemo /> : <TextDemo />}
</div>
);
}
15 changes: 15 additions & 0 deletions src/fab/_example/style/index.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
.tdesign-mobile-demo {
background-color: #f6f6f6;
}

.fab-container {
li {
display: flex;
justify-content: center;
margin-bottom: 12px;

.fab-btn {
width: 350px;
border: 1px solid #dcdcdc;
color: #000;
font-size: 16px;
}
}
}
8 changes: 7 additions & 1 deletion src/fab/_example/text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ export default function () {
};
return (
<>
<Fab icon={<Icon name="add" />} text="按钮文字" style={{ right: '16px', bottom: '32px' }} onClick={onClick} />
<Fab
icon={<Icon name="add" />}
text="按钮文字"
style={{ right: '16px', bottom: '32px' }}
buttonProps={{ variant: 'outline' }}
onClick={onClick}
/>
</>
);
}

0 comments on commit b7ee5a6

Please sign in to comment.