From 4e3b4f94e33fd392b8ca36b50558c33a30105d71 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Wed, 14 Feb 2024 13:04:23 +0100 Subject: [PATCH] feat(ui): :wheelchair: add small screen support for header --- components/Header.css | 108 ++++++++++++++++++++++++++++++++++----- components/Header.tsx | 34 ++++++++---- islands/ThemePicker.css | 6 +++ src/stylesheets/base.css | 1 + 4 files changed, 126 insertions(+), 23 deletions(-) diff --git a/components/Header.css b/components/Header.css index 791af1b..cc73ead 100644 --- a/components/Header.css +++ b/components/Header.css @@ -15,7 +15,7 @@ header div { gap: var(--_gap); } -header span { +.components__header__brand { text-wrap: nowrap; padding: var(--_gap); font-size: large; @@ -23,6 +23,17 @@ header span { & a { text-decoration: none; + color: currentColor; + } + + @media (width < 800px) { + .components__header__brand__text { + display: none; + } + + & img { + min-width: 1rem; + } } } @@ -38,16 +49,6 @@ header nav { list-style: none; transition: border var(--_transition-delay) ease; border: var(--_border-size) solid transparent; - - & > a { - display: inline-block; - text-decoration: none; - outline: none; - } - - & > * { - padding: var(--_gap-half) var(--_gap); - } } & > li:hover, @@ -56,10 +57,17 @@ header nav { & > li:has(details[open]) { border: var(--_border-size) solid currentColor; } + + @media (width < 800px) { + & { + justify-content: space-around; + } + } } header details { cursor: pointer; + padding: var(--_gap-half); & summary { display: flex; @@ -67,11 +75,35 @@ header details { list-style: none; outline: none; + & i { + display: none; + } + &::after { display: inline-block; content: '▽'; transition: all var(--_transition-delay) ease; } + + @media (width < 800px) { + & { + display: grid; + gap: 0; + font-size: x-small; + justify-items: center; + align-items: center; + font-weight: normal; + } + + & i { + display: inline; + font-size: 1rem; + } + + &::after { + display: none; + } + } } &[open] summary::after { @@ -92,6 +124,13 @@ header details { calc(-1 * var(--_gap) - 2px), calc(var(--_gap-half) + 2px) ); + + @media (width < 800px) { + & { + border: var(--_border-size) solid currentColor; + transform: translate(-33%, var(--_gap)); + } + } } & li { @@ -112,9 +151,52 @@ header details { } } -header input { +.components__header__search { padding: var(--_gap-half) var(--_gap); align-self: center; - border: none; + border: var(--_border-size) solid transparent; background-color: var(--_translucent); + min-width: fit-content; + outline: none; + + &:focus-visible { + border: var(--_border-size) solid currentColor; + } + + @media (width < 800px) { + & { + background-color: transparent; + } + + & span { + display: none; + } + } +} + +.components__header__nav_button { + color: var(--_font-color); + display: inline-block; + text-decoration: none; + outline: none; + padding: var(--_gap-half) var(--_gap); + + & i { + display: none; + } + + @media (width < 800px) { + & { + display: grid; + font-size: x-small; + justify-items: center; + align-items: center; + font-weight: normal; + } + + & i { + display: inline; + font-size: 1rem; + } + } } diff --git a/components/Header.tsx b/components/Header.tsx index b564973..738c0a5 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -5,27 +5,38 @@ export function Header() { return (
- + - Cohabit POC + Coh + a + bit - +
diff --git a/islands/ThemePicker.css b/islands/ThemePicker.css index cbf28ee..9090872 100644 --- a/islands/ThemePicker.css +++ b/islands/ThemePicker.css @@ -26,4 +26,10 @@ font-weight: normal; line-height: normal; } + + @media (width < 800px) { + & select { + width: 0; + } + } } diff --git a/src/stylesheets/base.css b/src/stylesheets/base.css index 6cc817d..fa2af23 100644 --- a/src/stylesheets/base.css +++ b/src/stylesheets/base.css @@ -13,6 +13,7 @@ --_gap: var(--size-3); --_gap-half: calc(var(--_gap) / 2); --_wide-screen: 1400px; + --_small-screen: 800px; /* color */ --_accent-color: var(--lime-6);