File tree 1 file changed +18
-23
lines changed
site/content/tutorial/10-transitions/08-deferred-transitions/app-a
1 file changed +18
-23
lines changed Original file line number Diff line number Diff line change 1
1
<script >
2
2
import { quintOut } from ' svelte/easing' ;
3
- import crossfade from ' ./ crossfade.js ' ; // TODO put this in svelte/transition!
3
+ import { crossfade } from ' svelte/transition' ;
4
4
5
- const { send , receive } = crossfade ({
5
+ const [ send , receive ] = crossfade ({
6
6
fallback (node , params ) {
7
7
const style = getComputedStyle (node);
8
8
const transform = style .transform === ' none' ? ' ' : style .transform ;
46
46
47
47
function handleKeydown (event ) {
48
48
if (event .which === 13 ) {
49
- addTodo (event .target );
49
+ add (event .target );
50
50
}
51
51
}
52
52
</script >
53
53
54
54
<style >
55
- .new-todo {
56
- font-size : 1.4em ;
57
- width : 100% ;
58
- margin : 2em 0 1em 0 ;
59
- }
60
-
61
55
.board {
56
+ display : grid ;
57
+ grid-template-columns : 1fr 1fr ;
58
+ grid-gap : 1em ;
62
59
max-width : 36em ;
63
60
margin : 0 auto ;
64
61
}
65
62
66
- .left , .right {
67
- float : left ;
68
- width : 50% ;
69
- padding : 0 1em 0 0 ;
70
- box-sizing : border-box ;
63
+ .new-todo {
64
+ font-size : 1.4em ;
65
+ grid-column : 1 /3 ;
71
66
}
72
67
73
68
h2 {
74
69
font-size : 2em ;
75
70
font-weight : 200 ;
76
71
user-select : none ;
72
+ margin : 0 0 0.5em 0 ;
77
73
}
78
74
79
75
label {
80
- top : 0 ;
81
- left : 0 ;
82
- display : block ;
83
- font-size : 1em ;
84
76
line-height : 1 ;
85
77
padding : 0.5em ;
86
- margin : 0 auto 0.5em auto ;
78
+ margin : 0 0 0.5em 0 ;
87
79
border-radius : 2px ;
88
- background-color : #eee ;
89
80
user-select : none ;
81
+ border : 1px solid rgba (103 ,103 ,120 , 0.5 );
82
+ background-color : rgba (103 ,103 ,120 ,0.1 );
83
+ color : #333 ;
90
84
}
91
85
92
86
input { margin : 0 }
93
87
94
- .right label {
95
- background-color : rgb ( 180 , 240 , 100 ) ;
88
+ .done {
89
+ opacity : 0.3 ;
96
90
}
97
91
98
92
button {
114
108
</style >
115
109
116
110
<div class =' board' >
117
- <input class ="new-todo" placeholder ="what needs to be done?" on:enter ={ add }>
111
+ <input class ="new-todo" placeholder ="what needs to be done?" on:keydown ={ handleKeydown }>
118
112
119
113
<div class =' left' >
120
114
<h2 >todo</h2 >
134
128
<h2 >done</h2 >
135
129
{#each todos .filter (t => t .done ) as todo (todo .id )}
136
130
<label
131
+ class =" done"
137
132
in:receive =" {{key : todo .id }}"
138
133
out:send =" {{key : todo .id }}"
139
134
>
You can’t perform that action at this time.
0 commit comments