mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 22:41:17 +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>
29 lines
625 B
TypeScript
29 lines
625 B
TypeScript
import React from 'react';
|
|
import { Affix, Button } from 'antd';
|
|
|
|
const containerStyle: React.CSSProperties = {
|
|
width: '100%',
|
|
height: 100,
|
|
overflow: 'auto',
|
|
};
|
|
|
|
const style: React.CSSProperties = {
|
|
width: '100%',
|
|
height: 1000,
|
|
};
|
|
|
|
const App: React.FC = () => {
|
|
const [container, setContainer] = React.useState<HTMLDivElement | null>(null);
|
|
return (
|
|
<div style={containerStyle} ref={setContainer}>
|
|
<div style={style}>
|
|
<Affix target={() => container}>
|
|
<Button type="primary">Fixed at the top of container</Button>
|
|
</Affix>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|