Skip to content

Commit 2b6ee6b

Browse files
committed
Responsive styles for tester
1 parent 6074996 commit 2b6ee6b

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

TODO.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
- [ ] Corner click offset
77
- [ ] Footer
88
- [ ] Fade in on load
9+
- [ ] Detect theme preference
10+
- [ ] Hover states

demo/assets/css/style.scss

+20-6
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ input[type="color"] {
262262
body {
263263
display: grid;
264264
grid-template-rows: max-content 1fr;
265-
grid-template-columns: 1fr 1rem minmax(0rem, 52rem) 1rem 1fr;
265+
grid-template-columns: 1fr 2rem minmax(0rem, 52rem) 2rem 1fr;
266266
grid-template-areas:
267267
"header header header header header"
268268
". . main . .";
@@ -276,6 +276,7 @@ body {
276276
--rosewater --flamingo --pink --mauve --red --maroon --peach --yellow
277277
--green --teal --sky --sapphire --blue --lavender;
278278
transition-duration: 250ms;
279+
overflow-x: hidden;
279280
}
280281

281282
header {
@@ -393,7 +394,7 @@ th-drag-area {
393394

394395
th-control {
395396
display: grid;
396-
grid-template-rows: max-content 1.5rem;
397+
grid-template-rows: 2rem 1.5rem;
397398
grid-template-columns: 1fr;
398399
grid-template-areas: "label" "input";
399400
align-items: center;
@@ -435,13 +436,26 @@ th-corner {
435436
}
436437
}
437438

438-
@media (max-width: 500px) {
439+
@media (max-width: 740px) {
439440
th-tester {
440-
grid-template-rows: minmax(16rem, 1fr) min-content;
441-
grid-template-areas: "drag-area" "controls";
441+
grid-template-columns: 1fr;
442+
grid-template-rows: 32rem min-content;
443+
grid-template-areas: "drag-area" "form";
442444

443445
& > form {
444-
grid-template-columns: max-content 1fr max-content 1fr;
446+
grid-template-columns: 1fr 1fr;
447+
grid-template-rows: 1fr 1fr;
448+
row-gap: 1rem;
449+
column-gap: 2rem;
450+
}
451+
}
452+
}
453+
454+
@media (max-width: 480px) {
455+
th-tester {
456+
& > form {
457+
grid-template-columns: 1fr;
458+
grid-template-rows: repeat(4, 1fr);
445459
}
446460
}
447461
}

demo/assets/js/drag-area.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,23 @@ export class DragArea extends HTMLElement {
4646
this._width = width;
4747
this._height = height;
4848
}
49+
4950
this._l = Math.min(this._l, this._width);
5051
this._r = Math.min(this._r, this._width);
5152
this._t = Math.min(this._t, this._height);
5253
this._b = Math.min(this._b, this._height);
5354

55+
this._updateSquircleCorners();
56+
5457
if (this._topLeft !== null) {
5558
this._topLeft.x = `${this._l}px`;
5659
this._topLeft.y = `${this._t}px`;
5760
}
61+
5862
if (this._bottomRight !== null) {
5963
this._bottomRight.x = `${this._r}px`;
6064
this._bottomRight.y = `${this._b}px`;
6165
}
62-
63-
this._updateSquircleCorners();
6466
}
6567
});
6668
observer.observe(this);

0 commit comments

Comments
 (0)