Skip to content

Commit 01e2819

Browse files
committed
Improve and adapt demo app
1 parent fadf26f commit 01e2819

File tree

12 files changed

+50
-123
lines changed

12 files changed

+50
-123
lines changed

src/app.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
@use 'hgrid-css/sass/hgrid' with (
2-
$link-color: #b4006f
2+
3+
// These are examples of variables
4+
// you can customize. Full list:
5+
// https://github.com/ahansson/hgrid-css/blob/main/sass/variables/_variables.scss
6+
7+
$link-color: #b4006f,
8+
$body-bg: #f0d8a4,
9+
$turn-off-link-decoration: true,
10+
$use-global-link-underlines: true,
11+
$link-underline-color: #d569a6
312
);

src/lib/Counter/index.svelte

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
<div class="counter">
1717
<button on:click={() => (count -= 1)} aria-label="Decrease the counter by one">
18-
<svg aria-hidden="true" viewBox="0 0 1 1">
19-
<path d="M0,0.5 L1,0.5" />
20-
</svg>
18+
<span class="translate-push8v">-</span>
2119
</button>
2220

2321
<div class="counter-viewport">
@@ -28,9 +26,7 @@
2826
</div>
2927

3028
<button on:click={() => (count += 1)} aria-label="Increase the counter by one">
31-
<svg aria-hidden="true" viewBox="0 0 1 1">
32-
<path d="M0,0.5 L1,0.5 M0.5,0 L0.5,1" />
33-
</svg>
29+
<span class="translate-push8v">+</span>
3430
</button>
3531
</div>
3632

@@ -51,24 +47,13 @@
5147
border: 0;
5248
background-color: transparent;
5349
color: var(--text-color);
54-
font-size: 2rem;
50+
font-size: 4rem;
5551
}
5652
5753
.counter button:hover {
5854
background-color: var(--secondary-color);
5955
}
6056
61-
svg {
62-
width: 25%;
63-
height: 25%;
64-
}
65-
66-
path {
67-
vector-effect: non-scaling-stroke;
68-
stroke-width: 2px;
69-
stroke: var(--text-color);
70-
}
71-
7257
.counter-viewport {
7358
width: 8em;
7459
height: 4em;

src/lib/Header/index.svelte

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script>
22
import { page } from '$app/stores';
3-
import logo from './svelte-logo.svg';
3+
import logo from './../../../static/icon.png';
44
</script>
55

6-
<header>
7-
<div class="corner">
8-
<a href="https://kit.svelte.dev">
9-
<img src={logo} alt="SvelteKit" />
6+
<header class="flex justify-content-space-between">
7+
<div class="corner padding-10">
8+
<a href="https://hgrid.io">
9+
<img src={logo} alt="Hgrid" />
1010
</a>
1111
</div>
1212

@@ -24,21 +24,17 @@
2424
</svg>
2525
</nav>
2626

27-
<div class="corner">
28-
<!-- TODO put something else here? github link? -->
27+
<div class="corner pr-40 pt-10">
28+
<p><a href="https://github.com/ahansson/hgrid-css">GitHub</a></p>
2929
</div>
3030
</header>
3131

3232
<style>
33-
header {
34-
display: flex;
35-
justify-content: space-between;
36-
}
3733
38-
.corner {
39-
width: 3em;
40-
height: 3em;
41-
}
34+
.corner {
35+
width: 5.4rem;
36+
height: 5.4rem;
37+
}
4238
4339
.corner a {
4440
display: flex;
@@ -107,7 +103,7 @@
107103
padding: 0 1em;
108104
color: var(--heading-color);
109105
font-weight: 700;
110-
font-size: 0.8rem;
106+
font-size: 1.7rem;
111107
text-transform: uppercase;
112108
letter-spacing: 10%;
113109
text-decoration: none;

src/lib/Header/svelte-logo.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/routes/__layout.svelte

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,19 @@
55

66
<Header />
77

8-
<main>
8+
<main class="flex flex-1 f-direction-column padding-10 width-100pct margin-0-auto box-sizing-border-box">
99
<slot />
1010
</main>
1111

12-
<footer>
13-
<p>visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to learn SvelteKit</p>
12+
<footer class="text-center">
13+
<p>visit <a href="https://kit.svelte.dev" target="_blank" rel="noopener">kit.svelte.dev</a> to learn <code>SvelteKit</code></p>
14+
<p>visit <a href="https://hgrid.io" target="_blank" rel="noopener">hgrid.io</a> to get going with <code>hgrid-css</code></p>
1415
</footer>
1516

1617
<style>
17-
main {
18-
flex: 1;
19-
display: flex;
20-
flex-direction: column;
21-
padding: 1rem;
22-
width: 100%;
23-
max-width: 1024px;
24-
margin: 0 auto;
25-
box-sizing: border-box;
26-
}
27-
28-
footer {
29-
display: flex;
30-
flex-direction: column;
31-
justify-content: center;
32-
align-items: center;
33-
padding: 40px;
34-
}
35-
36-
footer a {
37-
font-weight: bold;
38-
}
39-
4018
@media (min-width: 480px) {
4119
footer {
42-
padding: 40px 0;
20+
padding: 4rem 0;
4321
}
4422
}
4523
</style>

src/routes/about.svelte

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@
1818
<title>About</title>
1919
</svelte:head>
2020

21-
<div class="content">
21+
<div class="content text-center padding-top-80 max-width-75pct margin-0-auto">
2222
<h1>About this app</h1>
2323

2424
<p>
25-
This is a <a href="https://kit.svelte.dev">SvelteKit</a> app. You can make your own by typing the
25+
This is a <a href="https://kit.svelte.dev" target="_blank">SvelteKit</a> app. You can make your own by typing the
2626
following into your command line and following the prompts:
2727
</p>
2828

29-
<!-- TODO lose the @next! -->
30-
<pre>npm init svelte@next</pre>
29+
<pre><code>npm init svelte</code></pre>
3130

3231
<p>
3332
The page you're looking at is purely static HTML, with no client-side interactivity needed.
@@ -40,11 +39,3 @@
4039
it with JavaScript disabled!
4140
</p>
4241
</div>
43-
44-
<style>
45-
.content {
46-
width: 100%;
47-
max-width: var(--column-width);
48-
margin: var(--column-margin-top) auto 0 auto;
49-
}
50-
</style>

src/routes/index.svelte

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,15 @@
1010
<title>Home</title>
1111
</svelte:head>
1212

13-
<section>
14-
<h1>
15-
<div class="welcome">
16-
<picture>
17-
<source srcset="svelte-welcome.webp" type="image/webp" />
18-
<img src="svelte-welcome.png" alt="Welcome" />
19-
</picture>
20-
</div>
13+
<section class="flex f-direction-column justify-content-center align-items-center flex-1 text-center">
2114

22-
to your new<br />SvelteKit app
15+
<h1 class="mt-80">
16+
Welcome to your <br />SvelteKit demo app with CSS from <strong>hgrid</strong>
2317
</h1>
2418

25-
<h2>
26-
try editing <strong>src/routes/index.svelte</strong>
19+
<h2 class="h5 font-normal">
20+
This content is located in <code><mark>src/routes/index.svelte</mark></code>
2721
</h2>
2822

2923
<Counter />
3024
</section>
31-
32-
<style>
33-
section {
34-
display: flex;
35-
flex-direction: column;
36-
justify-content: center;
37-
align-items: center;
38-
flex: 1;
39-
}
40-
41-
h1 {
42-
width: 100%;
43-
}
44-
45-
.welcome {
46-
position: relative;
47-
width: 100%;
48-
height: 0;
49-
padding: 0 0 calc(100% * 495 / 2048) 0;
50-
}
51-
52-
.welcome img {
53-
position: absolute;
54-
width: 100%;
55-
height: 100%;
56-
top: 0;
57-
display: block;
58-
}
59-
</style>

src/routes/todos/index.svelte

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<title>Todos</title>
4242
</svelte:head>
4343

44-
<div class="todos">
44+
<div class="todos text-center max-width-75pct margin-0-auto padding-100">
4545
<h1>Todos</h1>
4646

4747
<form
@@ -77,8 +77,8 @@
7777
result: patch
7878
}}
7979
>
80-
<input type="hidden" name="done" value={todo.done ? '' : 'true'} />
81-
<button class="toggle" aria-label="Mark todo as {todo.done ? 'not done' : 'done'}" />
80+
<input class="margin-0" type="hidden" name="done" value={todo.done ? '' : 'true'} />
81+
<button class="toggle translate-push40h" aria-label="Mark todo as {todo.done ? 'not done' : 'done'}" />
8282
</form>
8383

8484
<form
@@ -117,7 +117,7 @@
117117
}
118118
119119
.new {
120-
margin: 0 0 0.5rem 0;
120+
margin: 0 0 2rem 0;
121121
}
122122
123123
input {
@@ -126,7 +126,7 @@
126126
127127
input:focus-visible {
128128
box-shadow: inset 1px 1px 6px rgba(0, 0, 0, 0.1);
129-
border: 1px solid #ff3e00 !important;
129+
border: 2px solid #b70e71 !important;
130130
outline: none;
131131
}
132132
@@ -142,7 +142,7 @@
142142
143143
.todo {
144144
display: grid;
145-
grid-template-columns: 2rem 1fr 2rem;
145+
grid-template-columns: 6rem 1fr 2rem;
146146
grid-gap: 0.5rem;
147147
align-items: center;
148148
margin: 0 0 0.5rem 0;
@@ -156,12 +156,11 @@
156156
157157
.done {
158158
transform: none;
159-
opacity: 0.4;
159+
opacity: 0.6;
160160
filter: drop-shadow(0px 0px 1px rgba(0, 0, 0, 0.1));
161161
}
162162
163163
form.text {
164-
position: relative;
165164
display: flex;
166165
align-items: center;
167166
flex: 1;
@@ -171,6 +170,7 @@
171170
flex: 1;
172171
padding: 0.5em 2em 0.5em 0.8em;
173172
border-radius: 3px;
173+
margin: unset;
174174
}
175175
176176
.todo button {
@@ -180,13 +180,17 @@
180180
background-color: transparent;
181181
background-position: 50% 50%;
182182
background-repeat: no-repeat;
183+
position: relative;
184+
top: 1rem;
185+
right: 3rem;
183186
}
184187
185188
button.toggle {
186189
border: 1px solid rgba(0, 0, 0, 0.2);
187190
border-radius: 50%;
188191
box-sizing: border-box;
189192
background-size: 1em auto;
193+
padding: unset;
190194
}
191195
192196
.done .toggle {

static/favicon.png

-941 Bytes
Loading

static/icon.png

630 Bytes
Loading

static/svelte-welcome.png

-352 KB
Binary file not shown.

static/svelte-welcome.webp

-113 KB
Binary file not shown.

0 commit comments

Comments
 (0)