Skip to content

Commit 1bf38b7

Browse files
Rich-HarrisRich Harris
and
Rich Harris
authored
Tighten up styles (#278)
* update styles * update exercise * remove duplicate file * more styles * nicer styles * more tweaks --------- Co-authored-by: Rich Harris <[email protected]>
1 parent 6129e86 commit 1bf38b7

File tree

36 files changed

+250
-262
lines changed

36 files changed

+250
-262
lines changed

content/tutorial/01-svelte/03-props/03-spread-props/app-a/src/lib/PackageInfo.svelte

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,3 @@
1313
<a {href}>npm</a>
1414
and <a href={website}>learn more here</a>
1515
</p>
16-
17-
<style>
18-
code {
19-
font-family: Menlo;
20-
padding: 0.1em 0.2em;
21-
border-radius: 0.2em;
22-
}
23-
</style>

content/tutorial/01-svelte/04-logic/05-keyed-each-blocks/app-a/src/lib/Thing.svelte

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,4 @@
1515
const emoji = emojis[name];
1616
</script>
1717

18-
<p>
19-
<span>The emoji for {name} is {emoji}</span>
20-
</p>
21-
22-
<style>
23-
p {
24-
margin: 0.8em 0;
25-
}
26-
27-
span {
28-
display: inline-block;
29-
padding: 0.2em 1em 0.3em;
30-
text-align: center;
31-
border-radius: 0.2em;
32-
background-color: #ffdfd3;
33-
}
34-
35-
@media (prefers-color-scheme: dark) {
36-
span {
37-
background-color: #4f352b;
38-
}
39-
}
40-
</style>
18+
<p>{emoji} = {name}</p>

content/tutorial/01-svelte/05-events/01-dom-events/app-a/src/lib/App.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
<style>
1515
div {
16+
position: fixed;
17+
left: 0;
18+
top: 0;
1619
width: 100%;
1720
height: 100%;
21+
padding: 1rem;
1822
}
1923
</style>

content/tutorial/01-svelte/05-events/01-dom-events/app-b/src/lib/App.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
<style>
1515
div {
16+
position: fixed;
17+
left: 0;
18+
top: 0;
1619
width: 100%;
1720
height: 100%;
21+
padding: 1rem;
1822
}
1923
</style>

content/tutorial/01-svelte/05-events/02-inline-handlers/app-a/src/lib/App.svelte

Lines changed: 0 additions & 19 deletions
This file was deleted.

content/tutorial/01-svelte/05-events/02-inline-handlers/app-b/src/lib/App.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
<style>
1414
div {
15+
position: fixed;
16+
left: 0;
17+
top: 0;
1518
width: 100%;
1619
height: 100%;
20+
padding: 1rem;
1721
}
1822
</style>

content/tutorial/01-svelte/05-events/06-dom-event-forwarding/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ title: DOM event forwarding
44

55
Event forwarding works for DOM events too.
66

7-
We want to get notified of clicks on our `<CustomButton>` — to do that, we just need to forward `click` events on the `<button>` element in `CustomButton.svelte`:
7+
We want to get notified of clicks on our `<BigRedButton>` — to do that, we just need to forward `click` events on the `<button>` element in `BigRedButton.svelte`:
88

99
```svelte
1010
<button +++on:click+++>
11-
Click me
11+
Push
1212
</button>
1313
```
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<script>
2-
import CustomButton from './CustomButton.svelte';
2+
import BigRedButton from './BigRedButton.svelte';
3+
import horn from './horn.mp3';
4+
5+
const audio = new Audio();
6+
audio.src = horn;
37
48
function handleClick() {
5-
alert('Button Clicked');
9+
audio.play();
610
}
711
</script>
812

9-
<CustomButton on:click={handleClick} />
13+
<BigRedButton on:click={handleClick} />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<button>
2+
Push
3+
</button>
4+
5+
<style>
6+
button {
7+
font-size: 1.4em;
8+
width: 6em;
9+
height: 6em;
10+
border-radius: 50%;
11+
background: radial-gradient(circle at 25% 25%, hsl(0, 100%, 50%) 0, hsl(0, 100%, 40%) 100%);
12+
box-shadow: 0 8px 0 hsl(0, 100%, 30%), 2px 12px 10px rgba(0,0,0,.35);
13+
color: hsl(0, 100%, 30%);
14+
text-shadow: -1px -1px 2px rgba(0,0,0,0.3), 1px 1px 2px rgba(255,255,255,0.4);
15+
text-transform: uppercase;
16+
letter-spacing: 0.05em;
17+
transform: translate(0, -8px);
18+
transition: all 0.2s;
19+
}
20+
21+
button:active {
22+
transform: translate(0, -2px);
23+
box-shadow: 0 2px 0 hsl(0, 100%, 30%), 2px 6px 10px rgba(0,0,0,.35);
24+
}
25+
</style>

content/tutorial/01-svelte/05-events/06-dom-event-forwarding/app-a/src/lib/CustomButton.svelte

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<button on:click>
2+
Push
3+
</button>
4+
5+
<style>
6+
button {
7+
font-size: 1.4em;
8+
width: 6em;
9+
height: 6em;
10+
border-radius: 50%;
11+
background: radial-gradient(circle at 25% 25%, hsl(0, 100%, 50%) 0, hsl(0, 100%, 40%) 100%);
12+
box-shadow: 0 8px 0 hsl(0, 100%, 30%), 2px 12px 10px rgba(0,0,0,.35);
13+
color: hsl(0, 100%, 30%);
14+
text-shadow: -1px -1px 2px rgba(0,0,0,0.3), 1px 1px 2px rgba(255,255,255,0.4);
15+
text-transform: uppercase;
16+
letter-spacing: 0.05em;
17+
transform: translate(0, -8px);
18+
transition: all 0.2s;
19+
}
20+
21+
button:active {
22+
transform: translate(0, -2px);
23+
box-shadow: 0 2px 0 hsl(0, 100%, 30%), 2px 6px 10px rgba(0,0,0,.35);
24+
}
25+
</style>

content/tutorial/01-svelte/05-events/06-dom-event-forwarding/app-b/src/lib/CustomButton.svelte

Lines changed: 0 additions & 24 deletions
This file was deleted.

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/app-a/src/lib/App.svelte

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,3 @@
3636
</label>
3737

3838
<p>{a} + {b} = {a + b}</p>
39-
40-
<style>
41-
label {
42-
display: flex;
43-
}
44-
45-
input,
46-
p {
47-
margin: 6px;
48-
}
49-
</style>

content/tutorial/01-svelte/06-bindings/02-numeric-inputs/app-b/src/lib/App.svelte

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,3 @@
3636
</label>
3737

3838
<p>{a} + {b} = {a + b}</p>
39-
40-
<style>
41-
label {
42-
display: flex;
43-
}
44-
45-
input,
46-
p {
47-
margin: 6px;
48-
}
49-
</style>

content/tutorial/01-svelte/06-bindings/06-select-bindings/app-a/src/lib/App.svelte

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,4 @@
5050
selected question {selected
5151
? selected.id
5252
: '[waiting...]'}
53-
</p>
54-
55-
<style>
56-
input {
57-
display: block;
58-
width: 500px;
59-
max-width: 100%;
60-
}
61-
</style>
53+
</p>

content/tutorial/01-svelte/06-bindings/06-select-bindings/app-b/src/lib/App.svelte

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,3 @@
5151
? selected.id
5252
: '[waiting...]'}
5353
</p>
54-
55-
<style>
56-
input {
57-
display: block;
58-
width: 500px;
59-
max-width: 100%;
60-
}
61-
</style>

content/tutorial/01-svelte/07-lifecycle/02-ondestroy/app-a/src/lib/Timer.svelte

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@
77
onInterval(callback, interval);
88
</script>
99

10-
<p>
11-
This component executes a callback every
12-
{interval} millisecond{interval === 1
13-
? ''
14-
: 's'}
15-
</p>
10+
<p>This component executes a callback every {interval}ms</p>
1611

1712
<style>
1813
p {

content/tutorial/01-svelte/common/src/routes/+layout.svelte

Lines changed: 0 additions & 26 deletions
This file was deleted.

content/tutorial/03-advanced-svelte/02-transitions/09-deferred-transitions/app-a/src/lib/App.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@
4646
.board > input {
4747
font-size: 1.4em;
4848
grid-column: 1/3;
49-
border-radius: 5px;
50-
background: #f4f4f4;
5149
padding: 0.5em;
52-
border: none;
50+
margin: 0 0 1rem 0;
5351
}
5452
5553
h2 {

content/tutorial/03-advanced-svelte/03-animations/01-animate/app-a/src/lib/App.svelte

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,8 @@
4646
.board > input {
4747
font-size: 1.4em;
4848
grid-column: 1/3;
49-
border-radius: 5px;
50-
background: #f4f4f4;
5149
padding: 0.5em;
52-
border: none;
53-
color: black;
50+
margin: 0 0 1rem 0;
5451
}
5552
5653
h2 {

content/tutorial/03-advanced-svelte/05-bindings/05-bind-this/app-a/src/lib/App.svelte

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@
5555

5656
<style>
5757
canvas {
58+
position: fixed;
59+
left: 0;
60+
top: 0;
5861
width: 100%;
5962
height: 100%;
6063
background-color: #666;
61-
-webkit-mask: url(svelte-logo-mask.svg) 50%
62-
50% no-repeat;
63-
mask: url(svelte-logo-mask.svg) 50% 50%
64-
no-repeat;
64+
mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
65+
mask-size: 40%;
66+
-webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
67+
-webkit-mask-size: 40%;
6568
}
6669
</style>

content/tutorial/03-advanced-svelte/05-bindings/05-bind-this/app-b/src/lib/App.svelte

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,15 @@
5959

6060
<style>
6161
canvas {
62+
position: fixed;
63+
left: 0;
64+
top: 0;
6265
width: 100%;
6366
height: 100%;
6467
background-color: #666;
65-
-webkit-mask: url(svelte-logo-mask.svg) 50%
66-
50% no-repeat;
67-
mask: url(svelte-logo-mask.svg) 50% 50%
68-
no-repeat;
68+
mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
69+
mask-size: 40%;
70+
-webkit-mask: url(svelte-logo-mask.svg) 50% 50% no-repeat;
71+
-webkit-mask-size: 40%;
6972
}
7073
</style>

0 commit comments

Comments
 (0)