Skip to content

Commit 3ae1c77

Browse files
authored
Merge pull request sveltejs#53 from sveltejs/vedam-design
Facelift
2 parents 33d59a4 + 58eefaa commit 3ae1c77

File tree

10 files changed

+429
-336
lines changed

10 files changed

+429
-336
lines changed

content/tutorial/01-svelte/01-introduction/01-welcome-to-svelte/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ This tutorial is split into four main parts:
2727

2828
Each section will present an exercise designed to illustrate a feature. Later sections build on the knowledge gained in earlier ones, so it's recommended that you go from start to finish. If necessary, you can navigate via the menu above.
2929

30-
If you get stuck, you can click the `Solve` button to the left of the editor. (It's disabled on sections like this one that don't include an exercise.) Try not to rely on it too much; you will learn faster by figuring out where to put each suggested code block and manually typing it in to the editor.
30+
If you get stuck, you can click the `solve` button to the left of the editor. (It's disabled on sections like this one that don't include an exercise.) Try not to rely on it too much; you will learn faster by figuring out where to put each suggested code block and manually typing it in to the editor.

src/routes/__layout.svelte

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,18 @@
6767
position: relative;
6868
top: var(--nav-h);
6969
}
70+
71+
.large {
72+
display: none;
73+
}
74+
75+
@media (min-width: 800px) {
76+
.small {
77+
display: none;
78+
}
79+
80+
.large {
81+
display: inline;
82+
}
83+
}
7084
</style>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<script>
2+
import { createEventDispatcher } from 'svelte';
3+
import refresh from './refresh.svg';
4+
5+
/** @type {string} */
6+
export let path;
7+
8+
const dispatch = createEventDispatcher();
9+
</script>
10+
11+
<div class="chrome">
12+
<button on:click={() => dispatch('refresh')} aria-label="reload">
13+
<img src={refresh} alt="Reload icon" />
14+
</button>
15+
16+
<input
17+
aria-label="URL"
18+
value={path}
19+
on:change={(e) => {
20+
dispatch('change', { value: e.currentTarget.value });
21+
}}
22+
/>
23+
</div>
24+
25+
<style>
26+
.chrome {
27+
width: 100%;
28+
height: 4rem;
29+
display: flex;
30+
gap: 0.5rem;
31+
padding: 0.4rem;
32+
background: #f9f9f9;
33+
}
34+
35+
.chrome button {
36+
padding: 0.5rem;
37+
}
38+
39+
.chrome button img {
40+
height: 100%;
41+
width: auto;
42+
transition: 0.2s ease-out;
43+
transform: none;
44+
}
45+
46+
.chrome button:active img {
47+
transform: rotate(-180deg);
48+
transition: none;
49+
}
50+
51+
.chrome input {
52+
flex: 1;
53+
padding: 0.5rem 1rem 0.4rem 1rem;
54+
border-radius: 0.5rem;
55+
border: 1px solid rgba(0, 0, 0, 0.1);
56+
box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1);
57+
font-family: inherit;
58+
font-size: 1.6rem;
59+
}
60+
</style>

src/routes/tutorial/[slug]/_/Menu/Menu.svelte

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,36 @@
4949
}
5050
</script>
5151

52-
<button class="menu-toggle" on:click={() => (is_open = !is_open)} aria-label="Toggle menu" aria-expanded={is_open}>
53-
<Icon name={is_open ? 'close' : 'menu'} />
54-
</button>
52+
<div class="menu-toggle-container">
53+
<button
54+
class="menu-toggle"
55+
on:click={() => (is_open = !is_open)}
56+
aria-label="Toggle menu"
57+
aria-expanded={is_open}
58+
>
59+
<Icon name={is_open ? 'close' : 'menu'} />
60+
</button>
61+
</div>
5562

5663
<nav class:open={is_open} aria-label="tutorial sections">
5764
<div class="controls">
58-
<input type="search" placeholder="Search" bind:value={search} aria-hidden={!is_open ? "true" : null} tabindex={!is_open ? -1 : null} />
65+
<input
66+
type="search"
67+
placeholder="Search"
68+
bind:value={search}
69+
aria-hidden={!is_open ? 'true' : null}
70+
tabindex={!is_open ? -1 : null}
71+
/>
5972
</div>
6073

6174
<div class="sections">
6275
<ul>
6376
{#each filtered as part (part.slug)}
64-
<li class="part" transition:slide|local={{ duration }}>
77+
<li
78+
class="part"
79+
transition:slide|local={{ duration }}
80+
class:expanded={part.slug === current.part.slug}
81+
>
6582
<a sveltekit:prefetch href="/tutorial/{part.first}" data-label={part.label}>
6683
Part {part.label}: {part.title}
6784
</a>
@@ -114,10 +131,10 @@
114131
height: 100%;
115132
transition: transform 0.2s;
116133
transform: translate(calc(var(--menu-width) - 100%), 0);
117-
background: var(--second);
134+
background: var(--back-api);
118135
z-index: 2;
119136
/* filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1)); */
120-
border-right: 1px solid rgba(255, 255, 255, 0.1);
137+
border-right: 1px solid var(--border-color);
121138
display: flex;
122139
flex-direction: column;
123140
}
@@ -129,51 +146,48 @@
129146
.controls {
130147
height: var(--menu-width);
131148
display: flex;
132-
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
133-
padding: 1rem 1rem 1rem calc(var(--menu-width) + 1rem);
149+
border-bottom: 1px solid var(--border-color);
150+
padding: 0 0 0 var(--menu-width);
134151
}
135152
136153
.controls input {
137154
flex: 1;
138-
border-radius: 0.5rem;
139155
border: none;
140156
padding: 0.6rem 1rem 0.5rem 1rem;
141157
font-family: inherit;
142158
font-size: inherit;
143-
background: hsl(240, 8%, 54%);
144-
color: white;
145-
}
146-
147-
.controls input::placeholder {
148-
color: rgba(255, 255, 255, 0.5);
159+
background: rgba(255, 255, 255, 0.5);
160+
border: 2px solid transparent;
161+
color: var(--text);
149162
}
150163
151164
.controls input:focus {
152-
background: white;
153-
color: var(--text);
154165
outline: none;
166+
border: 2px solid var(--flash);
155167
}
156168
157-
.controls input:focus::placeholder {
158-
color: #333;
159-
}
160-
161-
.menu-toggle {
169+
.menu-toggle-container {
162170
position: absolute;
163171
left: 0;
164172
top: 0;
165173
width: var(--menu-width);
166174
height: var(--menu-width);
167175
z-index: 3;
168-
/* background: linear-gradient(
169-
to right,
170-
var(--second),
171-
var(--second) calc(100% - 1rem),
172-
transparent
173-
); */
174-
background: var(--second);
175-
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
176-
border-right: 1px solid rgba(255, 255, 255, 0.1);
176+
border-right: 1px solid var(--border-color);
177+
border-bottom: 1px solid var(--border-color);
178+
}
179+
180+
.menu-toggle {
181+
width: 100%;
182+
height: 100%;
183+
background: var(--back-api);
184+
border: 2px solid transparent;
185+
box-sizing: border-box;
186+
}
187+
188+
.menu-toggle:focus-visible {
189+
outline: none;
190+
border: 2px solid var(--flash);
177191
}
178192
179193
.sections {
@@ -185,7 +199,7 @@
185199
ul {
186200
position: relative;
187201
list-style: none;
188-
padding: 0 0 0 2rem;
202+
padding: 0 0 0 1.5rem;
189203
margin: 0;
190204
}
191205
@@ -197,19 +211,23 @@
197211
position: relative;
198212
}
199213
200-
li[aria-current='page'] {
201-
font-weight: bold;
214+
li[aria-current='page'] a {
215+
color: var(--prime);
202216
}
203217
204218
li img {
205219
position: absolute;
206-
left: -2.5rem;
220+
left: -2rem;
207221
top: 0.3rem;
208222
width: 2rem;
209223
height: 2rem;
210224
transition: transform 0.2s;
211225
}
212226
227+
li.expanded > a {
228+
font-weight: bold;
229+
}
230+
213231
li.expanded img {
214232
transform: rotate(90deg);
215233
}
@@ -221,14 +239,14 @@
221239
222240
.section {
223241
--dot-size: 1.2rem;
224-
--color: hsl(240, 8%, 95%);
242+
--color: var(--second);
225243
}
226244
227245
.section > a::before,
228246
.section > a::after {
229247
content: '';
230248
top: calc(1.3rem - 0.5 * var(--dot-size));
231-
right: calc(0.5 * (var(--menu-width) - var(--dot-size)));
249+
right: calc(0.5 * (var(--menu-width) - var(--dot-size)) - 0.7rem);
232250
width: var(--dot-size);
233251
height: var(--dot-size);
234252
border-radius: 50%;
@@ -248,7 +266,7 @@
248266
width: var(--menu-width);
249267
text-align: center;
250268
top: 0.2rem;
251-
right: 0;
269+
right: -0.7rem;
252270
color: hsl(240, 8%, 64%);
253271
}
254272
@@ -257,9 +275,18 @@
257275
}
258276
259277
a {
260-
color: white;
261-
padding: 0.2rem 0;
278+
color: var(--second);
279+
padding: 0 0 0 0.5rem;
280+
margin: 0 0.5rem 0 0;
262281
display: block;
263282
font-variant-numeric: tabular-nums;
283+
border: 2px solid transparent;
284+
box-sizing: border-box;
285+
}
286+
287+
a:focus-visible {
288+
/* outline-color: var(--flash); */
289+
outline: none;
290+
border: 2px solid var(--flash);
264291
}
265292
</style>
Lines changed: 1 addition & 1 deletion
Loading

src/routes/tutorial/[slug]/_/Menu/collapsed.svg

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

src/routes/tutorial/[slug]/_/Menu/expanded.svg

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

0 commit comments

Comments
 (0)