= ({
- width = 24,
- height = 24,
- className,
-}) => (
-
+ {label[0]?.toUpperCase() || '?'}
+
)
// 获取交易所图标的函数
@@ -225,22 +80,22 @@ export const getExchangeIcon = (
exchangeType: string,
props: IconProps = {}
) => {
- // 支持完整ID或类型名
- const type = exchangeType.toLowerCase().includes('binance')
+ const lowerType = exchangeType.toLowerCase()
+ const type = lowerType.includes('binance')
? 'binance'
- : exchangeType.toLowerCase().includes('bybit')
+ : lowerType.includes('bybit')
? 'bybit'
- : exchangeType.toLowerCase().includes('okx')
+ : lowerType.includes('okx')
? 'okx'
- : exchangeType.toLowerCase().includes('bitget')
+ : lowerType.includes('bitget')
? 'bitget'
- : exchangeType.toLowerCase().includes('hyperliquid')
+ : lowerType.includes('hyperliquid')
? 'hyperliquid'
- : exchangeType.toLowerCase().includes('aster')
+ : lowerType.includes('aster')
? 'aster'
- : exchangeType.toLowerCase().includes('lighter')
+ : lowerType.includes('lighter')
? 'lighter'
- : exchangeType.toLowerCase()
+ : lowerType
const iconProps = {
width: props.width || 24,
@@ -248,42 +103,10 @@ export const getExchangeIcon = (
className: props.className,
}
- switch (type) {
- case 'binance':
- return
- case 'bybit':
- return
- case 'okx':
- return
- case 'bitget':
- return
- case 'hyperliquid':
- case 'dex':
- return
- case 'aster':
- return
- case 'lighter':
- return
- case 'cex':
- default:
- return (
-
- {type[0]?.toUpperCase() || '?'}
-
- )
+ const path = ICON_PATHS[type]
+ if (path) {
+ return
}
+
+ return
}