Skip to content

Commit b173750

Browse files
committed
start updating deferred transition chapter
1 parent f04225f commit b173750

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

site/content/tutorial/10-transitions/08-deferred-transitions/app-a/App.svelte

+18-23
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script>
22
import { quintOut } from 'svelte/easing';
3-
import crossfade from './crossfade.js'; // TODO put this in svelte/transition!
3+
import { crossfade } from 'svelte/transition';
44
5-
const { send, receive } = crossfade({
5+
const [send, receive] = crossfade({
66
fallback(node, params) {
77
const style = getComputedStyle(node);
88
const transform = style.transform === 'none' ? '' : style.transform;
@@ -46,53 +46,47 @@
4646
4747
function handleKeydown(event) {
4848
if (event.which === 13) {
49-
addTodo(event.target);
49+
add(event.target);
5050
}
5151
}
5252
</script>
5353

5454
<style>
55-
.new-todo {
56-
font-size: 1.4em;
57-
width: 100%;
58-
margin: 2em 0 1em 0;
59-
}
60-
6155
.board {
56+
display: grid;
57+
grid-template-columns: 1fr 1fr;
58+
grid-gap: 1em;
6259
max-width: 36em;
6360
margin: 0 auto;
6461
}
6562
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;
7166
}
7267
7368
h2 {
7469
font-size: 2em;
7570
font-weight: 200;
7671
user-select: none;
72+
margin: 0 0 0.5em 0;
7773
}
7874
7975
label {
80-
top: 0;
81-
left: 0;
82-
display: block;
83-
font-size: 1em;
8476
line-height: 1;
8577
padding: 0.5em;
86-
margin: 0 auto 0.5em auto;
78+
margin: 0 0 0.5em 0;
8779
border-radius: 2px;
88-
background-color: #eee;
8980
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;
9084
}
9185
9286
input { margin: 0 }
9387
94-
.right label {
95-
background-color: rgb(180,240,100);
88+
.done {
89+
opacity: 0.3;
9690
}
9791
9892
button {
@@ -114,7 +108,7 @@
114108
</style>
115109

116110
<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}>
118112

119113
<div class='left'>
120114
<h2>todo</h2>
@@ -134,6 +128,7 @@
134128
<h2>done</h2>
135129
{#each todos.filter(t => t.done) as todo (todo.id)}
136130
<label
131+
class="done"
137132
in:receive="{{key: todo.id}}"
138133
out:send="{{key: todo.id}}"
139134
>

0 commit comments

Comments
 (0)