File tree Expand file tree Collapse file tree 4 files changed +54
-81
lines changed Expand file tree Collapse file tree 4 files changed +54
-81
lines changed Original file line number Diff line number Diff line change @@ -36,48 +36,45 @@ const computeClass = (className: string) => {
36
36
37
37
/** - 生成复用的button */
38
38
39
- const ButtonIcon : FC < Props > = memo (
40
- ( {
41
- children,
42
- className = 'h-36px text-icon' ,
43
- icon,
44
- style,
45
- tooltipContent,
46
- tooltipPlacement = 'bottom' ,
47
- triggerParent,
48
- zIndex = 98 ,
49
- ...rest
50
- } ) => {
51
- const cls = computeClass ( className ) ;
39
+ const ButtonIcon = ( {
40
+ children,
41
+ className = 'h-36px text-icon' ,
42
+ icon,
43
+ style,
44
+ tooltipContent,
45
+ tooltipPlacement = 'bottom' ,
46
+ triggerParent,
47
+ zIndex = 98 ,
48
+ ...rest
49
+ } : Props ) => {
50
+ const cls = computeClass ( className ) ;
52
51
53
- function getPopupContainer ( triggerNode : HTMLElement ) {
54
- return triggerParent ? triggerNode . parentElement ! : document . body ;
55
- }
56
-
57
- return (
58
- < ATooltip
59
- getPopupContainer = { getPopupContainer }
60
- placement = { tooltipPlacement }
61
- title = { tooltipContent }
62
- zIndex = { zIndex }
63
- >
64
- < AButton
65
- className = { cls }
66
- type = "text"
67
- { ...rest }
68
- >
69
- < div className = "flex-center gap-8px" >
70
- { children || (
71
- < SvgIcon
72
- icon = { icon }
73
- style = { style }
74
- />
75
- ) }
76
- </ div >
77
- </ AButton >
78
- </ ATooltip >
79
- ) ;
52
+ function getPopupContainer ( triggerNode : HTMLElement ) {
53
+ return triggerParent ? triggerNode . parentElement ! : document . body ;
80
54
}
81
- ) ;
82
55
56
+ return (
57
+ < ATooltip
58
+ getPopupContainer = { getPopupContainer }
59
+ placement = { tooltipPlacement }
60
+ title = { tooltipContent }
61
+ zIndex = { zIndex }
62
+ >
63
+ < AButton
64
+ className = { cls }
65
+ type = "text"
66
+ { ...rest }
67
+ >
68
+ < div className = "flex-center gap-8px" >
69
+ { children || (
70
+ < SvgIcon
71
+ icon = { icon }
72
+ style = { style }
73
+ />
74
+ ) }
75
+ </ div >
76
+ </ AButton >
77
+ </ ATooltip >
78
+ ) ;
79
+ } ;
83
80
export default ButtonIcon ;
Original file line number Diff line number Diff line change 1
1
import { Icon } from '@iconify/react' ;
2
2
import type { CSSProperties } from 'react' ;
3
- /**
4
- * Props
5
- *
6
- * - Support iconify and local svg icon
7
- * - If icon and localIcon are passed at the same time, localIcon will be rendered first
8
- */
3
+
9
4
interface Props {
10
5
readonly className ?: string ;
11
6
/** Iconify icon name */
@@ -16,12 +11,21 @@ interface Props {
16
11
}
17
12
18
13
const defaultLocalIcon = 'no-icon' ;
14
+
19
15
const { VITE_ICON_LOCAL_PREFIX : prefix } = import . meta. env ;
16
+
20
17
const symbolId = ( localIcon : string = defaultLocalIcon ) => {
21
18
const iconName = localIcon || defaultLocalIcon ;
22
19
23
20
return `#${ prefix } -${ iconName } ` ;
24
21
} ;
22
+
23
+ /**
24
+ * Props
25
+ *
26
+ * - Support iconify and local svg icon
27
+ * - If icon and localIcon are passed at the same time, localIcon will be rendered first
28
+ */
25
29
const SvgIcon = ( { icon, localIcon, ...props } : Props ) => {
26
30
/** If localIcon is passed, render localIcon first */
27
31
return localIcon || ! icon ? (
Original file line number Diff line number Diff line change 1
- import * as motion from 'motion/ react-m ' ;
1
+ import type { SVGProps } from 'react' ;
2
2
3
- const SystemLogo = memo ( ( props : { className ?: string } ) => {
4
- const [ hideStroke , { setTrue } ] = useBoolean ( ) ;
5
-
6
- const draw = {
7
- animate : { fill : 'currentColor' , pathLength : 1 } ,
8
- fill : 'transparent' ,
9
- initial : { fill : 'transparent' , pathLength : 0 } ,
10
- stroke : hideStroke ? 'none' : 'currentColor' ,
11
- strokeWidth : '2' ,
12
- transition : {
13
- fill : { delay : 2 , duration : 1 , ease : 'easeInOut' } ,
14
- pathLength : { duration : 2 , ease : 'easeInOut' }
15
- }
16
- } ;
17
- return (
18
- < motion . svg
19
- viewBox = "0 0 160 160"
20
- { ...props }
21
- >
22
- < motion . path
23
- { ...draw }
24
- d = "M81.28 55.9c-.1-11.67-2.93-22.55-9.37-32.38-1-1.5-2.14-2.86-2.5-4.71a8.1 8.1 0 014-8.61 7.89 7.89 0 019.3 1.23 35.999 35.999 0 015.9 8.83 75.18 75.18 0 018.44 28.58 83.211 83.211 0 01-5.23 36.74 102.983 102.983 0 01-3 7.28 1.2 1.2 0 000 1.41c9.58 13.3 21.76 23 37.85 27.24a54.37 54.37 0 0019.68 1.57 7.72 7.72 0 018.36 6.9 7.903 7.903 0 01-6.7 9 64.744 64.744 0 01-23-1.33 77.68 77.68 0 01-36.93-19.88 93.628 93.628 0 01-11.91-13.71 2.18 2.18 0 00-2.3-1.06 72.744 72.744 0 00-27.38 7.55c-11.6 6-20.67 14.58-26.4 26.45a10.134 10.134 0 01-3.7 4.7 8 8 0 01-9.19-.7 7.86 7.86 0 01-2.36-9.28 60.324 60.324 0 018.72-14.52c12.2-15.43 28.21-24.59 47.32-28.57A85.085 85.085 0 0173.07 87c.524.015 1-.307 1.18-.8a76.06 76.06 0 006.53-22.3c.351-2.652.518-5.325.5-8z"
25
- />
26
- < motion . path
27
- { ...draw }
28
- d = "M136.26 108.34a44.742 44.742 0 01-11.13-2.87 46.108 46.108 0 01-19.66-13.76 8 8 0 015.72-13.22 7.93 7.93 0 016.54 2.93 33.27 33.27 0 0018.87 10.75c1.546.155 3.058.553 4.48 1.18a8.08 8.08 0 013.84 9.21c-.92 3.52-4.13 5.81-8.66 5.78zm-80.6-75.02a7.61 7.61 0 016.64 5 49.139 49.139 0 013.64 17 46.33 46.33 0 01-2.46 17.28c-2 5.77-8.24 7.79-12.89 4.15a8.1 8.1 0 01-2.39-9 31.679 31.679 0 001.68-12.36 35.77 35.77 0 00-2.43-11c-2.1-5.45 1.75-11.07 8.21-11.07zm22.26 93.25a8 8 0 01-6.68 7.86 32.88 32.88 0 00-19.7 12.19 8.13 8.13 0 01-11.21 1.62 8 8 0 01-1.41-11.58A51.043 51.043 0 0154 123.81a45.842 45.842 0 0114-5.1c5.35-1.04 9.91 2.56 9.92 7.86z"
29
- onAnimationComplete = { setTrue }
30
- />
31
- </ motion . svg >
32
- ) ;
33
- } ) ;
3
+ const SystemLogo = ( props : SVGProps < SVGSVGElement > ) => {
4
+ return < IconLocalLogo { ...props } /> ;
5
+ } ;
34
6
35
7
export default SystemLogo ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ interface Props {
5
5
themeColor : string ;
6
6
}
7
7
8
- const WaveBg = memo ( ( { themeColor } : Props ) => {
8
+ const WaveBg = ( { themeColor } : Props ) => {
9
9
const lightColor = getPaletteColorByNumber ( themeColor , 200 ) ;
10
10
const darkColor = getPaletteColorByNumber ( themeColor , 500 ) ;
11
11
@@ -93,6 +93,6 @@ const WaveBg = memo(({ themeColor }: Props) => {
93
93
</ div >
94
94
</ div >
95
95
) ;
96
- } ) ;
96
+ } ;
97
97
98
98
export default WaveBg ;
You can’t perform that action at this time.
0 commit comments