Skip to content

Commit a0b4f9b

Browse files
gin-lslthinkasany
andauthored
site: Components overview add Sui adapter (#1117)
* site: Components overview add Sui adapter * Update .dumi/theme/builtins/Overview/index.tsx Co-authored-by: thinkasany <[email protected]> * chore: del adapters' image cover --------- Co-authored-by: thinkasany <[email protected]>
1 parent 804cf3e commit a0b4f9b

File tree

9 files changed

+49
-29
lines changed

9 files changed

+49
-29
lines changed

.dumi/theme/builtins/Overview/index.tsx

+49-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import { useMemo } from 'react';
2-
import { Affix, Card, Col, Divider, Flex, Input, Row, Tag, Typography } from 'antd';
2+
import {
3+
BitcoinCircleColorful,
4+
EthereumCircleColorful,
5+
SolanaCircleColorful,
6+
SuiCircleColorful,
7+
TonCircleColorful,
8+
} from '@ant-design/web3-icons';
9+
import { Card, Col, Flex, Row, Tag, Typography } from 'antd';
310
import { createStyles } from 'antd-style';
411
import { Link, usePrefersColor, useSidebarData } from 'dumi';
512

6-
const useStyle = createStyles(({ token, css }) => ({
13+
const AdapterCovers: Record<string, React.ReactNode> = {
14+
Bitcoin: <BitcoinCircleColorful />,
15+
Ethereum: <EthereumCircleColorful />,
16+
Solana: <SolanaCircleColorful />,
17+
Sui: <SuiCircleColorful />,
18+
TON: <TonCircleColorful />,
19+
};
20+
21+
const useStyle = createStyles(({ token, css }, { dark }: { dark: boolean }) => ({
722
componentsOverviewGroupTitle: css`
823
margin-bottom: ${token.marginLG}px !important;
924
`,
@@ -18,6 +33,23 @@ const useStyle = createStyles(({ token, css }) => ({
1833
justify-content: center;
1934
height: 152px;
2035
`,
36+
componentOverviewAdapterCover: css`
37+
display: inline-flex;
38+
align-items: center;
39+
justify-content: center;
40+
padding: 7px;
41+
width: 50px;
42+
height: 50px;
43+
border-radius: 36px;
44+
font-size: 44px;
45+
background-image: ${dark
46+
? `linear-gradient(175deg, #262525 -8%, #363535 32%)`
47+
: `linear-gradient(175deg, #f5f8fc -8%, #ffffff 32%)`};
48+
border-image-slice: 1;
49+
box-shadow: ${dark
50+
? `0px 0 14px 2px rgba(210, 198, 255, 0.25), inset 0px -2px 0 0 #525355`
51+
: `0px 25px 14px 2px rgba(210, 198, 255, 0.25), inset 0px -4px 0 0 #e6ebf3`};
52+
`,
2153
componentsOverviewCard: css`
2254
cursor: pointer;
2355
transition: all 0.5s;
@@ -54,9 +86,9 @@ const useStyle = createStyles(({ token, css }) => ({
5486

5587
export default () => {
5688
const data = useSidebarData();
57-
const { styles } = useStyle();
5889
const { Title } = Typography;
5990
const [color = 'light'] = usePrefersColor();
91+
const { styles } = useStyle({ dark: color.includes('dark') });
6092

6193
const groups = useMemo(
6294
() =>
@@ -92,11 +124,11 @@ export default () => {
92124
</Title>
93125
<Row gutter={[24, 24]}>
94126
{components.map((component) => {
95-
let url = `${component.link}`;
127+
const icon = AdapterCovers[component.title];
96128

97129
return (
98130
<Col xs={24} sm={12} lg={8} xl={6} key={component?.title}>
99-
<Link to={url} prefetch>
131+
<Link to={component.link} prefetch>
100132
<Card
101133
size="small"
102134
className={styles.componentsOverviewCard}
@@ -107,14 +139,18 @@ export default () => {
107139
}
108140
>
109141
<div className={styles.componentsOverviewImg}>
110-
<img
111-
src={
112-
color.includes('dark') && component.coverDark
113-
? component.coverDark
114-
: component.cover
115-
}
116-
alt={component?.title}
117-
/>
142+
{icon ? (
143+
<div className={styles.componentOverviewAdapterCover}>{icon}</div>
144+
) : (
145+
<img
146+
src={
147+
color.includes('dark') && component.coverDark
148+
? component.coverDark
149+
: component.cover
150+
}
151+
alt={component?.title}
152+
/>
153+
)}
118154
</div>
119155
</Card>
120156
</Link>

packages/web3/src/bitcoin/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ order: 1
44
group:
55
title: Connect Blockchains
66
order: 2
7-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*0Q62Q7VE6ncAAAAAAAAAAAAADlrGAQ/original
8-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*vETQSJI75-4AAAAAAAAAAAAADlrGAQ/original
97
---
108

119
# Bitcoin

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ order: 1
55
group:
66
title: 连接链
77
order: 2
8-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*0Q62Q7VE6ncAAAAAAAAAAAAADlrGAQ/original
9-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*vETQSJI75-4AAAAAAAAAAAAADlrGAQ/original
108
---
119

1210
# Bitcoin

packages/web3/src/ethereum/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ order: 2
44
group:
55
title: Connect Blockchains
66
order: 2
7-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*GbIiQYH7qf0AAAAAAAAAAAAADlrGAQ/original
8-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*umZtTpZ5MHYAAAAAAAAAAAAADlrGAQ/original
97
---
108

119
# Ethereum

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ order: 2
55
group:
66
title: 连接链
77
order: 2
8-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*GbIiQYH7qf0AAAAAAAAAAAAADlrGAQ/original
9-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*umZtTpZ5MHYAAAAAAAAAAAAADlrGAQ/original
108
---
119

1210
# Ethereum

packages/web3/src/solana/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ order: 5
44
group:
55
title: Connect Blockchains
66
order: 2
7-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*VJDJSoFtt2MAAAAAAAAAAAAADlrGAQ/original
8-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*ZsbbTIAI3nIAAAAAAAAAAAAADlrGAQ/original
97
---
108

119
# Solana

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

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ order: 5
55
group:
66
title: 连接链
77
order: 2
8-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*VJDJSoFtt2MAAAAAAAAAAAAADlrGAQ/original
9-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*ZsbbTIAI3nIAAAAAAAAAAAAADlrGAQ/original
108
---
119

1210
# Solana

packages/web3/src/ton/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ order: 6
44
group:
55
title: Connect Blockchains
66
order: 2
7-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*AS6lTZiDHgcAAAAAAAAAAAAADlrGAQ/original
8-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*VGWkQauYH3MAAAAAAAAAAAAADlrGAQ/original
97
---
108

119
# TON

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

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ order: 6
44
group:
55
title: 连接链
66
order: 2
7-
cover: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*AS6lTZiDHgcAAAAAAAAAAAAADlrGAQ/original
8-
coverDark: https://mdn.alipayobjects.com/huamei_mutawc/afts/img/A*VGWkQauYH3MAAAAAAAAAAAAADlrGAQ/original
97
---
108

119
# TON

0 commit comments

Comments
 (0)