1- import { LitElement , html } from " lit" ;
2- import { property } from " lit/decorators.js" ;
3- import { classMap } from " lit/directives/class-map.js" ;
1+ import { LitElement , html } from ' lit' ;
2+ import { property } from ' lit/decorators.js' ;
3+ import { classMap } from ' lit/directives/class-map.js' ;
44
55export class Spinner extends LitElement {
6- @property ( ) variant :
7- | "primary"
8- | "inverse" = "primary" ;
6+ @property ( ) variant : 'primary' | 'inverse' = 'primary' ;
97
10- render ( ) {
11- return html `
12- < svg class =${ classMap ( {
13- spinner : true ,
14- [ this . variant ] : true ,
15- } ) } xmlns ="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 600 600" >
16-
17- < defs >
18- < linearGradient id ="Gradient1 " gradientTransform ="rotate(90) ">
19- < stop offset ="0% " stop-opacity ="1 " stop-color ="currentColor " "/>
20- < stop offset ="100% " stop-opacity ="0.5 " stop-color ="currentColor "/>
21- </ linearGradient >
22- < linearGradient id ="Gradient2 " gradientTransform ="rotate(90) ">
23- < stop offset ="0% " stop-opacity ="0 " stop-color ="currentColor "/>
24- < stop offset ="90% " stop-opacity ="0.5 " stop-color ="currentColor "/>
25- < stop offset ="100% " stop-opacity ="0.65 " stop-color ="currentColor "/>
26- </ linearGradient >
27- < pattern id ="Pattern " x ="0 " y ="0 " width ="600 " height ="600 " patternUnits ="userSpaceOnUse ">
28- < g >
29- < rect shape-rendering ="crispEdges " x ="0 " y ="0 " width ="300 " height ="600 " fill ="url(#Gradient1) "/>
30- < rect shape-rendering ="crispEdges " x ="300 " y ="0 " width ="300 " height ="600 " fill ="url(#Gradient2) "/>
31- </ g >
32- </ pattern >
33- </ defs >
34- < path class ="rotating " style ="stroke: url(#Pattern); " fill ='transparent ' stroke-width ='80 ' d ='M 364 58 A 250 250 0 1 1 235 58 '/>
35- </ svg >
36- ` ;
37- }
38- }
8+ render ( ) {
9+ return html `
10+ < svg
11+ part ="svg "
12+ class =${ classMap ( {
13+ spinner : true ,
14+ [ this . variant ] : true ,
15+ } ) }
16+ xmlns ="http://www.w3.org/2000/svg"
17+ version="1.1"
18+ viewBox="0 0 600 600"
19+ >
20+ < defs >
21+ < linearGradient id ="Gradient1 " gradientTransform ="rotate(90) ">
22+ < stop offset ="0% " stop-opacity ="1 " stop-color ="currentColor " />
23+ < stop offset ="100% " stop-opacity ="0.5 " stop-color ="currentColor " />
24+ </ linearGradient >
25+ < linearGradient id ="Gradient2 " gradientTransform ="rotate(90) ">
26+ < stop offset ="0% " stop-opacity ="0 " stop-color ="currentColor " />
27+ < stop offset ="90% " stop-opacity ="0.5 " stop-color ="currentColor " />
28+ < stop offset ="100% " stop-opacity ="0.65 " stop-color ="currentColor " />
29+ </ linearGradient >
30+ < pattern
31+ id ="Pattern "
32+ x ="0 "
33+ y ="0 "
34+ width ="600 "
35+ height ="600 "
36+ patternUnits ="userSpaceOnUse "
37+ >
38+ < g >
39+ < rect
40+ shape-rendering ="crispEdges "
41+ x ="0 "
42+ y ="0 "
43+ width ="300 "
44+ height ="600 "
45+ fill ="url(#Gradient1) "
46+ />
47+ < rect
48+ shape-rendering ="crispEdges "
49+ x ="300 "
50+ y ="0 "
51+ width ="300 "
52+ height ="600 "
53+ fill ="url(#Gradient2) "
54+ />
55+ </ g >
56+ </ pattern >
57+ </ defs >
58+ < path
59+ class ="rotating "
60+ style ="stroke: url(#Pattern); "
61+ fill ="transparent "
62+ stroke-width ="80 "
63+ d ="M 364 58 A 250 250 0 1 1 235 58 "
64+ />
65+ </ svg >
66+ ` ;
67+ }
68+ }
0 commit comments