Skip to content

Commit 1bf38b7

Browse files
Rich-HarrisRich Harris
andauthored
Tighten up styles (sveltejs#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.

0 commit comments

Comments
 (0)