ant-design/components/anchor/demo/targetOffset.tsx
MadCcc de555912c9
feat: anchor ink ball style (#38616)
* feat: anchor ink ball style

* chore: code clean

* chore: code clean

* chore: code clean

* chore: update snapshot

* chore: change cover
2022-11-17 16:49:09 +08:00

26 lines
704 B
TypeScript

import React, { useEffect, useState } from 'react';
import { Anchor } from 'antd';
const { Link } = Anchor;
const App: React.FC = () => {
const [targetOffset, setTargetOffset] = useState<number | undefined>(undefined);
useEffect(() => {
setTargetOffset(window.innerHeight / 2);
}, []);
return (
<Anchor targetOffset={targetOffset}>
<Link href="#components-anchor-demo-basic" title="Basic demo" />
<Link href="#components-anchor-demo-static" title="Static demo" />
<Link href="#api" title="API">
<Link href="#anchor-props" title="Anchor Props" />
<Link href="#link-props" title="Link Props" />
</Link>
</Anchor>
);
};
export default App;