ant-design/components/affix/demo/basic.tsx
lijianan be92498f15
refactor: rewrite Affix CC => FC (#42674)
* 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>
2023-10-07 18:53:14 +08:00

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;