File tree 13 files changed +21
-23
lines changed
samples/tutorials/reactivity
site/tutorials/content/reactivity
13 files changed +21
-23
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,8 @@ export class MyElement extends LitElement {
16
16
17
17
render ( ) {
18
18
return html `
19
- < button @click =${ this . flipCoin } > Flip a coin!</ button >
20
- < p > Result: ${ this . result } </ p >
21
-
19
+ < button @click =${ this . flipCoin } > Flip a coin!</ button >
20
+ < p > Result: ${ this . result } </ p >
22
21
` ;
23
22
}
24
23
}
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ export class MyElement extends LitElement {
16
16
17
17
render ( ) {
18
18
return html `
19
- < button @click =${ this . flipCoin } > Flip a coin!</ button >
20
- < p > Result: ${ this . result } </ p >
19
+ < button @click =${ this . flipCoin } > Flip a coin!</ button >
20
+ < p > Result: ${ this . result } </ p >
21
21
` ;
22
22
}
23
23
}
Original file line number Diff line number Diff line change @@ -17,9 +17,8 @@ export class MyElement extends LitElement {
17
17
18
18
render ( ) {
19
19
return html `
20
- < button @click =${ this . flipCoin } > Flip a coin!</ button >
21
- < p > Result: ${ this . result } </ p >
22
-
20
+ < button @click =${ this . flipCoin } > Flip a coin!</ button >
21
+ < p > Result: ${ this . result } </ p >
23
22
` ;
24
23
}
25
24
}
Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ export class MyElement extends LitElement {
15
15
16
16
render ( ) {
17
17
return html `
18
- < button @click =${ this . flipCoin } > Flip a coin!</ button >
19
- < p > Result: ${ this . result } </ p >
20
-
18
+ < button @click =${ this . flipCoin } > Flip a coin!</ button >
19
+ < p > Result: ${ this . result } </ p >
21
20
` ;
22
21
}
23
22
}
Original file line number Diff line number Diff line change @@ -15,8 +15,8 @@ export class MyElement extends LitElement {
15
15
16
16
render ( ) {
17
17
return html `
18
- ${ map ( this . groceries , ( item ) =>
19
- html `< button @click =${ ( ) => this . removeItem ( item ) } > x</ button > ${ item } < br > `
18
+ ${ map ( this . groceries , ( item ) =>
19
+ html `< button @click =${ ( ) => this . removeItem ( item ) } > x</ button > ${ item } < br > `
20
20
) }
21
21
` ;
22
22
}
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ export class MyElement extends LitElement {
14
14
15
15
render ( ) {
16
16
return html `
17
- ${ map ( this . groceries , ( item ) =>
18
- html `< button @click =${ ( ) => this . removeItem ( item ) } > x</ button > ${ item } < br > `
17
+ ${ map ( this . groceries , ( item ) =>
18
+ html `< button @click =${ ( ) => this . removeItem ( item ) } > x</ button > ${ item } < br > `
19
19
) }
20
20
` ;
21
21
}
Original file line number Diff line number Diff line change @@ -31,6 +31,6 @@ export class MyElement extends LitElement {
31
31
< label > Backward: < input id ="backward " @input =${ this . onInput } .value =${ this . backward } > </ label >
32
32
< div > Forward text: ${ this . forward } </ div >
33
33
< div > Backward text: ${ this . backward } </ div >
34
- `
34
+ ` ;
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ export class MyElement extends LitElement {
21
21
< label > Backward: < input id ="backward " @input =${ this . onInput } .value =${ this . backward } > </ label >
22
22
< div > Forward text: ${ this . forward } </ div >
23
23
< div > Backward text: ${ this . backward } </ div >
24
- `
24
+ ` ;
25
25
}
26
26
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class MyElement extends LitElement {
33
33
if ( changedProperties . has ( '_showMessage' ) ) {
34
34
const final = this . _message . getBoundingClientRect ( ) . width ;
35
35
const starting = 0 - final ;
36
- var player = this . _message . animate ( [
36
+ this . _message . animate ( [
37
37
{ transform : `translateX(${ starting } px)` } ,
38
38
{ transform : `translateX(0)` }
39
39
] , {
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class MyElement extends LitElement {
18
18
_showMessage = false ;
19
19
20
20
@query ( '#message' )
21
- _message ! : HTMLParagraphElement ;
21
+ _message ! : HTMLDivElement ;
22
22
23
23
render ( ) {
24
24
return html `
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ export class ByeElement extends LitElement {
18
18
_showMessage = false ;
19
19
20
20
@query ( '#message' )
21
- _message ! : HTMLParagraphElement ;
21
+ _message ! : HTMLDivElement ;
22
22
23
23
render ( ) {
24
24
return html `
@@ -28,11 +28,12 @@ export class ByeElement extends LitElement {
28
28
</ div >
29
29
` ;
30
30
}
31
+
31
32
protected updated ( changedProperties : PropertyValues < this> ) : void {
32
33
if ( changedProperties . has ( '_showMessage' ) ) {
33
34
const rect = this . _message . getBoundingClientRect ( ) ;
34
35
const startingX = 0 - rect . width ;
35
- var player = this . _message . animate ( [
36
+ this . _message . animate ( [
36
37
{ transform : `translateX(${ startingX } px) scale(0.1)` } ,
37
38
{ transform : `translateX(0) translateY(0) scale(1)` }
38
39
] , {
Original file line number Diff line number Diff line change 31
31
},
32
32
{
33
33
"title" : " Recap" ,
34
- "hasAfter " : true
34
+ "noSolve " : true
35
35
}
36
36
]
37
37
}
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ Add the following `updated()` method to the component:
27
27
if (changedProperties .has (' _showMessage' )) {
28
28
const final = this ._message .getBoundingClientRect ().width ;
29
29
const starting = 0 - final;
30
- var player = this ._message .animate ([
30
+ this ._message .animate ([
31
31
{ transform: ` translateX(${ starting} px)` },
32
32
{ transform: ` translateX(0)` }
33
33
], {
You can’t perform that action at this time.
0 commit comments