mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 04:18:28 +08:00
be92498f15
* fix * test * Update index.ts * fix * fix * fix * fix: fix * fix: fix * fix: fix * fix: fix * fix: fix * fix: fix * update docs * Update components/affix/index.tsx Co-authored-by: kiner-tang(文辉) <1127031143@qq.com> Signed-off-by: lijianan <574980606@qq.com> * fix * test: add test case * Update components/affix/index.zh-CN.md Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * update demo --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: kiner-tang(文辉) <1127031143@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
25 lines
587 B
TypeScript
25 lines
587 B
TypeScript
import React from 'react';
|
|
import { Affix, Button } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [top, setTop] = React.useState<number>(100);
|
|
const [bottom, setBottom] = React.useState<number>(100);
|
|
return (
|
|
<>
|
|
<Affix offsetTop={top}>
|
|
<Button type="primary" onClick={() => setTop(top + 10)}>
|
|
Affix top
|
|
</Button>
|
|
</Affix>
|
|
<br />
|
|
<Affix offsetBottom={bottom}>
|
|
<Button type="primary" onClick={() => setBottom(bottom + 10)}>
|
|
Affix bottom
|
|
</Button>
|
|
</Affix>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|