From 133516ece148cf14ba3d3e91198086a1f490d6ed Mon Sep 17 00:00:00 2001 From: sleepyfran Date: Tue, 29 Oct 2024 17:29:24 +0100 Subject: [PATCH] Semi-responsive support --- .../library/src/library-selection.ts | 1 + .../ui-atoms/src/layouts/two-column.layout.ts | 31 +++- packages/web/index.css | 148 ++++++++++++++++++ packages/web/index.html | 66 +------- 4 files changed, 174 insertions(+), 72 deletions(-) create mode 100644 packages/web/index.css diff --git a/packages/components/library/src/library-selection.ts b/packages/components/library/src/library-selection.ts index aee58b3..88f14ef 100644 --- a/packages/components/library/src/library-selection.ts +++ b/packages/components/library/src/library-selection.ts @@ -18,6 +18,7 @@ export class LibrarySelection extends LitElement { static styles = css` nav { display: flex; + flex-wrap: wrap; } div.libraries { diff --git a/packages/components/ui-atoms/src/layouts/two-column.layout.ts b/packages/components/ui-atoms/src/layouts/two-column.layout.ts index ec5a8cd..a3982d9 100644 --- a/packages/components/ui-atoms/src/layouts/two-column.layout.ts +++ b/packages/components/ui-atoms/src/layouts/two-column.layout.ts @@ -13,16 +13,33 @@ export class TwoColumnLayout extends LitElement { } .left-column { - display: flex; - flex-direction: column; - padding: 1rem 5rem; - box-sizing: border-box; - width: 40%; + width: 100%; } .right-column { - padding-right: 5rem; - width: 80%; + width: 100%; + } + + @media (max-width: 767px) { + div.container { + padding: 1rem; + flex-wrap: wrap; + } + } + + @media (min-width: 768px) { + .left-column { + display: flex; + flex-direction: column; + padding: 1rem 5rem; + box-sizing: border-box; + width: 40%; + } + + .right-column { + padding-right: 5rem; + width: 80%; + } } `; diff --git a/packages/web/index.css b/packages/web/index.css new file mode 100644 index 0000000..a67965d --- /dev/null +++ b/packages/web/index.css @@ -0,0 +1,148 @@ +/* +From Jake Lazaroff's modern reset post: +https://jakelazaroff.com/words/my-modern-css-reset +*/ +@layer reset { + *, + *::before, + *::after { + box-sizing: border-box; + } + + * { + margin: 0; + padding: 0; + } + + body { + line-height: 1.5; + } + + img, + picture, + video, + canvas, + svg { + display: block; + max-width: 100%; + } + + input, + button, + textarea, + select { + font: inherit; + letter-spacing: inherit; + color: currentColor; + } + + p, + h1, + h2, + h3, + h4, + h5, + h6 { + overflow-wrap: break-word; + } + + ol, + ul { + list-style: none; + } + + :not([class]) { + h1&, + h2&, + h3&, + h4&, + h5&, + h6& { + margin-block: 0.75em; + line-height: 1.25; + text-wrap: balance; + letter-spacing: -0.05ch; + } + + p&, + ol&, + ul& { + margin-block: 1em; + } + + ol&, + ul& { + padding-inline-start: 1.5em; + list-style: revert; + } + + li& { + margin-block: 0.5em; + } + } +} + +@layer main { + @font-face { + font-family: "DepartureMono"; + src: url("/fonts/DepartureMono.otf") format("opentype"); + } + + :root { + /* Colors. */ + --font-family: "DepartureMono", monospace; + --background-color: #f4f4f9; + --background-color-muted: #e9e9f3; + --border-color: #e9e9f3; + --border-prominent-color: #007bff; + --disabled-background-color: #cccccc; + --primary-text-color: #333333; + --secondary-text-color: #555555; + --accent-color: #ff6f61; + --error-color: #dc3545; + --warning-color: #ffc107; + --button-background-color: #007bff; + --button-text-color: #ffffff; + --button-hover-background-color: #0056b3; + --button-secondary-background-color: transparent; + --button-secondary-text-color: #333333; + --button-secondary-hover-background-color: #007bff; + + /* Shadows. */ + --small-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); + --medium-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + --large-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + + /* Animations. */ + --short-transition-duration: 0.3s; + --medium-transition-duration: 0.4s; + --long-transition-duration: 0.5s; + } + + @media (prefers-color-scheme: dark) { + :root { + --background-color: #2e2e2e; + --background-color-muted: #3c3c3c; + --border-color: #3c3c3c; + --warning-color: #91731b; + --disabled-background-color: #666666; + --primary-text-color: #f4f4f9; + --secondary-text-color: #cccccc; + --button-background-color: #375a7f; + --button-text-color: #ffffff; + --button-hover-background-color: #2c3e50; + --button-secondary-text-color: #f4f4f9; + } + } + + html, + body { + height: fit-content; + } + + body { + background-color: var(--background-color); + color: var(--primary-text-color); + font-family: var(--font-family); + } +} diff --git a/packages/web/index.html b/packages/web/index.html index 990a8f7..65a5a5f 100644 --- a/packages/web/index.html +++ b/packages/web/index.html @@ -7,71 +7,7 @@ Echo - +