Skip to content

Commit 84afadc

Browse files
committed
Overall page styling
1 parent 2b0391a commit 84afadc

File tree

2 files changed

+63
-53
lines changed

2 files changed

+63
-53
lines changed

demo/assets/css/style.scss

+46-43
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
---
33

4-
/*
54
@property --subtext-1 {
65
syntax: "<color>";
76
inherits: true;
@@ -127,7 +126,6 @@
127126
inherits: true;
128127
initial-value: transparent;
129128
}
130-
*/
131129

132130
:where(:not(html, head *, svg *)) {
133131
all: unset;
@@ -156,8 +154,6 @@ th-theme-button {
156154
}
157155

158156
input[type="range"] {
159-
all: unset;
160-
161157
&::-moz-range-thumb,
162158
&::-webkit-slider-thumb {
163159
all: unset;
@@ -176,13 +172,12 @@ input[type="range"] {
176172
border-radius: calc(0.375rem / 2);
177173
background-color: var(--surface-0);
178174
border: 1px solid var(--surface-1);
179-
transition: background-color border-color 250ms;
180175
}
181176
}
182177

183178
input[type="color"] {
184-
all: unset;
185179
width: 100%;
180+
border-radius: 0.25rem;
186181

187182
&::-webkit-color-swatch-wrapper {
188183
all: unset;
@@ -267,7 +262,7 @@ input[type="color"] {
267262
body {
268263
display: grid;
269264
grid-template-rows: max-content 1fr;
270-
grid-template-columns: 1fr 1rem minmax(0rem, 48rem) 1rem 1fr;
265+
grid-template-columns: 1fr 1rem minmax(0rem, 52rem) 1rem 1fr;
271266
grid-template-areas:
272267
"header header header header header"
273268
". . main . .";
@@ -287,7 +282,7 @@ header {
287282
grid-area: header;
288283
display: grid;
289284
grid-template-columns: [title-start] max-content 1fr max-content [title-end];
290-
grid-template-rows: [title-start] 8rem [title-end];
285+
grid-template-rows: [title-start] 9.5rem [title-end];
291286
grid-template-areas: "banner . theme-button";
292287
}
293288

@@ -298,7 +293,7 @@ h1 {
298293
font-size: 3rem;
299294
width: 100%;
300295
text-align: center;
301-
margin-top: 1rem;
296+
margin-top: 2rem;
302297
}
303298

304299
th-theme-button {
@@ -308,13 +303,12 @@ th-theme-button {
308303
grid-template-columns: 100% 100%;
309304
place-content: stretch;
310305
overflow: hidden;
311-
width: 2rem;
312-
height: 2rem;
313-
margin: 0.5rem 0.5rem 0rem 0rem;
314-
--squircle-background-color: var(--surface-0);
315-
--squircle-border-width: 2px;
316-
--squircle-border-color: var(--surface-1);
317-
--squircle-border-radius: 4px;
306+
width: 2.25rem;
307+
height: 2.25rem;
308+
margin: 1rem 1rem 0rem 0rem;
309+
background-color: var(--surface-0);
310+
border: 2px solid var(--surface-1);
311+
border-radius: 0.25rem;
318312

319313
& > div {
320314
display: grid;
@@ -344,7 +338,6 @@ th-theme-button {
344338
width: 5rem;
345339
height: 5rem;
346340
clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
347-
transition: background-color 250ms;
348341
}
349342

350343
.github-logo {
@@ -353,7 +346,6 @@ th-theme-button {
353346
aspect-ratio: 98/96;
354347
transform: rotate(-45deg);
355348
fill: var(--base);
356-
transition: fill 250ms;
357349
}
358350

359351
main {
@@ -373,16 +365,18 @@ th-squircle {
373365
th-tester {
374366
grid-area: tester;
375367
display: grid;
376-
grid-template-rows: minmax(16rem, 1fr) min-content;
377-
grid-template-areas: "drag-area" "controls";
368+
grid-template-rows: minmax(32rem, 1fr);
369+
grid-template-columns: 1fr 16rem;
370+
grid-template-areas: "drag-area form";
371+
gap: 2rem;
378372

379373
& > form {
374+
grid-area: form;
380375
display: grid;
381-
grid-template-columns: max-content 1fr max-content 1fr;
382-
column-gap: 2rem;
376+
grid-template-columns: 1fr;
377+
grid-template-rows: repeat(4, max-content);
383378
row-gap: 1rem;
384379
grid-auto-rows: max-content;
385-
padding-top: 1rem;
386380
}
387381
}
388382

@@ -397,6 +391,25 @@ th-drag-area {
397391
}
398392
}
399393

394+
th-control {
395+
display: grid;
396+
grid-template-rows: max-content 1.5rem;
397+
grid-template-columns: 1fr;
398+
grid-template-areas: "label" "input";
399+
align-items: center;
400+
401+
& > label {
402+
grid-area: label;
403+
font-weight: 500;
404+
}
405+
406+
& > input {
407+
grid-area: input;
408+
width: 100%;
409+
height: 100%;
410+
}
411+
}
412+
400413
th-corner {
401414
position: absolute;
402415
display: grid;
@@ -407,38 +420,28 @@ th-corner {
407420

408421
&:hover::after {
409422
transform: scale(1.5);
423+
background-color: var(--sky);
410424
}
411425

412426
&::after {
413427
content: "";
414-
background-color: blue;
415-
opacity: 20%;
428+
background-color: var(--overlay-2);
429+
opacity: 30%;
416430
border-radius: 50%;
417431
width: 1.5rem;
418432
height: 1.5rem;
419-
transition-property: transform;
433+
transition-property: transform background-color;
420434
transition-duration: 250ms;
421435
}
422436
}
423437

424-
th-control {
425-
display: grid;
426-
grid-column-end: span 2;
427-
grid-template-columns: subgrid;
428-
align-items: center;
429-
430-
& > label {
431-
font-weight: 500;
432-
}
433-
434-
& > input {
435-
&[type="range"] {
436-
width: 100%;
437-
accent-color: var(--rosewater);
438-
}
438+
@media (max-width: 500px) {
439+
th-tester {
440+
grid-template-rows: minmax(16rem, 1fr) min-content;
441+
grid-template-areas: "drag-area" "controls";
439442

440-
&[type="color"] {
441-
height: 100%;
443+
& > form {
444+
grid-template-columns: max-content 1fr max-content 1fr;
442445
}
443446
}
444447
}

demo/index.html

+17-10
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,19 @@
2929
rel="stylesheet"
3030
/>
3131

32+
<style>
33+
body {
34+
margin: 0;
35+
}
36+
</style>
37+
3238
<title>Squircle Demo</title>
3339
</head>
3440

3541
<body class="theme-latte">
3642
<header>
3743
<h1>Squircle</h1>
38-
<th-theme-button class="squircle">
44+
<th-theme-button>
3945
<span class="sr">Theme toggle</span>
4046
<div>
4147
<svg
@@ -73,6 +79,7 @@ <h1>Squircle</h1>
7379
width="98"
7480
height="96"
7581
xmlns="http://www.w3.org/2000/svg"
82+
fill="white"
7683
>
7784
<path
7885
fill-rule="evenodd"
@@ -103,15 +110,6 @@ <h1>Squircle</h1>
103110
/>
104111
</th-control>
105112

106-
<th-control aspect="background-color">
107-
<label for="tester-input-background-color">Fill</label>
108-
<input
109-
id="tester-input-background-color"
110-
type="color"
111-
value="#7287fd"
112-
/>
113-
</th-control>
114-
115113
<th-control aspect="border-width">
116114
<label for="tester-input-border-radius">Border width</label>
117115
<input
@@ -131,6 +129,15 @@ <h1>Squircle</h1>
131129
value="#1e66f5"
132130
/>
133131
</th-control>
132+
133+
<th-control aspect="background-color">
134+
<label for="tester-input-background-color">Fill</label>
135+
<input
136+
id="tester-input-background-color"
137+
type="color"
138+
value="#7287fd"
139+
/>
140+
</th-control>
134141
</form>
135142
</th-tester>
136143
</main>

0 commit comments

Comments
 (0)