1
+ import { setAttributesNS } from "../util/setAttributesNS" ;
2
+
1
3
const WIDTH = 16 ;
2
4
const HEIGHT = 17 ;
3
5
const XMLNS = 'http://www.w3.org/2000/svg' ;
@@ -10,47 +12,41 @@ interface IconReturn {
10
12
$el : SVGElement ;
11
13
}
12
14
13
- function setAttributes < T extends SVGElement > ( el : T , attributes : Record < string , string > ) : T {
14
- Object . entries ( attributes ) . forEach ( ( [ key , val ] ) => {
15
- el . setAttributeNS ( null , key , val ) ;
16
- } ) ;
17
- return el ;
18
- }
19
-
20
15
/**
21
16
* Success Icon (checkmark)
22
17
*/
23
18
export function SuccessIcon ( { color } : Props ) : IconReturn {
24
- const svg = setAttributes ( document . createElementNS ( XMLNS , 'svg' ) , {
19
+ const cENS = document . createElementNS ;
20
+ const svg = setAttributesNS ( cENS ( XMLNS , 'svg' ) , {
25
21
width : `${ WIDTH } ` ,
26
22
height : `${ HEIGHT } ` ,
27
23
viewBox : `0 0 ${ WIDTH } ${ HEIGHT } ` ,
28
24
fill : 'none' ,
29
25
} ) ;
30
26
31
- const g = setAttributes ( document . createElementNS ( XMLNS , 'g' ) , {
27
+ const g = setAttributesNS ( cENS ( XMLNS , 'g' ) , {
32
28
clipPath : 'url(#clip0_57_156)' ,
33
29
} ) ;
34
30
35
- const path2 = setAttributes ( document . createElementNS ( XMLNS , 'path' ) , {
31
+ const path2 = setAttributesNS ( cENS ( XMLNS , 'path' ) , {
36
32
[ 'fill-rule' ] : 'evenodd' ,
37
33
[ 'clip-rule' ] : 'evenodd' ,
38
34
d : 'M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z' ,
39
35
fill : color ,
40
36
} ) ;
41
- const path = setAttributes ( document . createElementNS ( XMLNS , 'path' ) , {
37
+ const path = setAttributesNS ( cENS ( XMLNS , 'path' ) , {
42
38
d : 'M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z' ,
43
39
fill : color ,
44
40
} ) ;
45
41
46
42
svg . appendChild ( g ) . append ( path , path2 ) ;
47
43
48
- const speakerDefs = document . createElementNS ( XMLNS , 'defs' ) ;
49
- const speakerClipPathDef = setAttributes ( document . createElementNS ( XMLNS , 'clipPath' ) , {
44
+ const speakerDefs = cENS ( XMLNS , 'defs' ) ;
45
+ const speakerClipPathDef = setAttributesNS ( cENS ( XMLNS , 'clipPath' ) , {
50
46
id : 'clip0_57_156' ,
51
47
} ) ;
52
48
53
- const speakerRect = setAttributes ( document . createElementNS ( XMLNS , 'rect' ) , {
49
+ const speakerRect = setAttributesNS ( cENS ( XMLNS , 'rect' ) , {
54
50
width : `${ WIDTH } ` ,
55
51
height : `${ WIDTH } ` ,
56
52
fill : 'white' ,
@@ -66,15 +62,3 @@ export function SuccessIcon({ color }: Props): IconReturn {
66
62
$el : svg ,
67
63
} ;
68
64
}
69
-
70
- // <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
71
- // <g clip-path="url(#clip0_57_156)">
72
- // <path d="M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z" fill="#268D75"/>
73
- // <path fill-rule="evenodd" clip-rule="evenodd" d="M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z" fill="#268D75"/>
74
- // </g>
75
- // <defs>
76
- // <clipPath id="clip0_57_156">
77
- // <rect width="16" height="16" fill="white" transform="translate(0 0.5)"/>
78
- // </clipPath>
79
- // </defs>
80
- // </svg>
0 commit comments