Skip to content

Commit 80a3684

Browse files
zhengjunxianglem.zheng
andauthored
docs: Add addressPrefix demo for Address (#1475)
Co-authored-by: lem.zheng <[email protected]>
1 parent ee3ef61 commit 80a3684

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Address } from '@ant-design/web3';
2+
import { Space } from 'antd';
3+
4+
const App: React.FC = () => {
5+
return (
6+
<Space direction="vertical">
7+
<div>
8+
Default: <Address address={'3ea2cfd153b8d8505097b81c87c11f5d05097c18'} />
9+
</div>
10+
<div>
11+
Custom:{' '}
12+
<Address address={'3ea2cfd153b8d8505097b81c87c11f5d05097c18'} addressPrefix={'0xb1'} />
13+
</div>
14+
<div>
15+
No Prefix:{' '}
16+
<Address address={'3ea2cfd153b8d8505097b81c87c11f5d05097c18'} addressPrefix={false} />
17+
</div>
18+
</Space>
19+
);
20+
};
21+
22+
export default App;

packages/web3/src/address/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,18 @@ coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*ymJDSYEjQKwAAA
2525

2626
<code src="./demos/customTooltip.tsx"></code>
2727

28+
## AddressPrefix
29+
30+
<code src="./demos/addressPrefix.tsx"></code>
31+
2832
## API
2933

3034
| Property | Description | Type | Default | Version |
3135
| --- | --- | --- | --- | --- |
3236
| ellipsis | Address clipping strategy | `boolean \| { headClip?: number, tailClip?: number }` | `{ headClip: 6, tailClip: 4 }` | - |
3337
| copyable | Address copyable | `boolean` | `false` | - |
3438
| address | Address | `string` | - | - |
39+
| addressPrefix | The prefix to use for the address | `boolean \| string` | `0x` | - |
3540
| tooltip | Show tooltip when hover address | `boolean \|`[Tooltip.title](https://ant.design/components/tooltip-cn#api) | `true ` | - |
3641
| format | Address format | `boolean \| (input: string) => ReactNode` | `false` | - |
3742
| locale | Multilingual settings | `Locale["address"]` | - | - |

packages/web3/src/address/index.zh-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*ymJDSYEjQKwAAA
2626

2727
<code src="./demos/customTooltip.tsx"></code>
2828

29+
## 地址前缀
30+
31+
<code src="./demos/addressPrefix.tsx"></code>
32+
2933
## API
3034

3135
| 属性 | 描述 | 类型 | 默认值 | 版本 |
3236
| --- | --- | --- | --- | --- |
3337
| ellipsis | 地址裁剪策略 | `boolean \| { headClip?: number, tailClip?: number }` | `{ headClip: 6, tailClip: 4 }` | - |
3438
| copyable | 是否可复制 | `boolean` | `false` | - |
3539
| address | 地址 | `string` | - | - |
40+
| addressPrefix | 地址前缀 | `boolean \| string` | `0x` | - |
3641
| tooltip | 鼠标移入地址时展示提示 | `boolean \|` [Tooltip.title](https://ant.design/components/tooltip-cn#api) | `true ` | - |
3742
| format | 地址格式化 | `boolean \| (input: string) => ReactNode` | `false` | - |
3843
| locale | 多语言设置 | `Locale["address"]` | - | - |

0 commit comments

Comments
 (0)