1
1
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' ;
3
10
import { createStyles } from 'antd-style' ;
4
11
import { Link , usePrefersColor , useSidebarData } from 'dumi' ;
5
12
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 } ) => ( {
7
22
componentsOverviewGroupTitle : css `
8
23
margin-bottom : ${ token . marginLG } px !important ;
9
24
` ,
@@ -18,6 +33,23 @@ const useStyle = createStyles(({ token, css }) => ({
18
33
justify-content : center;
19
34
height : 152px ;
20
35
` ,
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
+ ` ,
21
53
componentsOverviewCard : css `
22
54
cursor : pointer;
23
55
transition : all 0.5s ;
@@ -54,9 +86,9 @@ const useStyle = createStyles(({ token, css }) => ({
54
86
55
87
export default ( ) => {
56
88
const data = useSidebarData ( ) ;
57
- const { styles } = useStyle ( ) ;
58
89
const { Title } = Typography ;
59
90
const [ color = 'light' ] = usePrefersColor ( ) ;
91
+ const { styles } = useStyle ( { dark : color . includes ( 'dark' ) } ) ;
60
92
61
93
const groups = useMemo (
62
94
( ) =>
@@ -92,11 +124,11 @@ export default () => {
92
124
</ Title >
93
125
< Row gutter = { [ 24 , 24 ] } >
94
126
{ components . map ( ( component ) => {
95
- let url = ` ${ component . link } ` ;
127
+ const icon = AdapterCovers [ component . title ] ;
96
128
97
129
return (
98
130
< Col xs = { 24 } sm = { 12 } lg = { 8 } xl = { 6 } key = { component ?. title } >
99
- < Link to = { url } prefetch >
131
+ < Link to = { component . link } prefetch >
100
132
< Card
101
133
size = "small"
102
134
className = { styles . componentsOverviewCard }
@@ -107,14 +139,18 @@ export default () => {
107
139
}
108
140
>
109
141
< 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
+ ) }
118
154
</ div >
119
155
</ Card >
120
156
</ Link >
0 commit comments