ant-design/components/anchor/demo/replace.tsx
Danial Soheili 4af6a526e2
feat(Anchor): allow replacing in anchor (#43006)
* 📦 ADD: replace prop to Anchor

* 📖 DOC: add demo

* 🧪 TEST: snapshots

* Update components/anchor/index.en-US.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

* Update components/anchor/index.en-US.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

* Update components/anchor/index.zh-CN.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

* Update components/anchor/index.zh-CN.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

* 🧪 TEST: Anchor replace

* 🧪 TEST: Anchor with href

* 🗑 REMOVE: unnecessary href default value

* Update components/anchor/demo/replace.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

* Update components/anchor/demo/replace.md

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>

---------

Co-authored-by: kiner-tang(文辉) <1127031143@qq.com>
2023-06-18 18:55:36 +08:00

37 lines
862 B
TypeScript

import { Anchor, Col, Row } from 'antd';
import React from 'react';
const App: React.FC = () => (
<Row>
<Col span={16}>
<div id="part-1" style={{ height: '100vh', background: 'rgba(255,0,0,0.02)' }} />
<div id="part-2" style={{ height: '100vh', background: 'rgba(0,255,0,0.02)' }} />
<div id="part-3" style={{ height: '100vh', background: 'rgba(0,0,255,0.02)' }} />
</Col>
<Col span={8}>
<Anchor
replace
items={[
{
key: 'part-1',
href: '#part-1',
title: 'Part 1',
},
{
key: 'part-2',
href: '#part-2',
title: 'Part 2',
},
{
key: 'part-3',
href: '#part-3',
title: 'Part 3',
},
]}
/>
</Col>
</Row>
);
export default App;