From a282d477fc904fa6f7e61f146aa847f2504f036f Mon Sep 17 00:00:00 2001 From: "Azat S." Date: Sun, 11 Aug 2024 14:02:09 +0300 Subject: [PATCH] docs: make documentation mobile-friendly --- docs/blocks/demo/index.module.css | 10 ++++- docs/blocks/footer/index.module.css | 5 --- docs/blocks/footer/index.tsx | 16 +++----- docs/blocks/header/index.module.css | 8 +++- docs/blocks/icons/index.module.css | 29 +++++++++---- docs/blocks/themes/index.module.css | 20 ++++++++- docs/blocks/themes/index.tsx | 2 +- .../illustration-icons/index.module.css | 1 + .../illustration-theme/index.module.css | 1 + docs/elements/netlify/index.module.css | 15 ------- docs/elements/netlify/index.tsx | 41 ------------------- docs/elements/theme-dropdown/index.module.css | 16 ++++++-- docs/elements/theme-select/index.module.css | 2 + docs/elements/theme-select/index.tsx | 9 ++-- docs/styles/base.css | 4 +- package.json | 2 +- 16 files changed, 88 insertions(+), 93 deletions(-) delete mode 100644 docs/elements/netlify/index.module.css delete mode 100644 docs/elements/netlify/index.tsx diff --git a/docs/blocks/demo/index.module.css b/docs/blocks/demo/index.module.css index 4656345..97dacb1 100644 --- a/docs/blocks/demo/index.module.css +++ b/docs/blocks/demo/index.module.css @@ -11,6 +11,7 @@ display: grid; grid-template-columns: 1fr; gap: var(--space-xl); + container-type: inline-size; @container (inline-size >= 980px) { grid-template-columns: 1fr 460px; @@ -24,9 +25,14 @@ .selection { display: grid; - grid-template-columns: minmax(auto, 400px) auto; - gap: var(--space-m); + grid-template-columns: 1fr; + gap: var(--space-xl); align-items: end; + + @container (inline-size >= 560px) { + grid-template-columns: minmax(auto, 400px) auto; + gap: var(--space-m); + } } .code-example { diff --git a/docs/blocks/footer/index.module.css b/docs/blocks/footer/index.module.css index 9edf810..3584e12 100644 --- a/docs/blocks/footer/index.module.css +++ b/docs/blocks/footer/index.module.css @@ -2,8 +2,3 @@ padding-block: var(--space-xl) calc(var(--space-l) * 2); background: var(--color-background-primary); } - -.container { - display: flex; - justify-content: space-between; -} diff --git a/docs/blocks/footer/index.tsx b/docs/blocks/footer/index.tsx index 1cb95c8..a4e941b 100644 --- a/docs/blocks/footer/index.tsx +++ b/docs/blocks/footer/index.tsx @@ -2,21 +2,17 @@ import { component$ } from '@builder.io/qwik' import { Typography } from '../../elements/typography' import { Container } from '../../elements/container' -import { Netlify } from '../../elements/netlify' import styles from './index.module.css' export let Footer = component$(() => ( )) diff --git a/docs/blocks/header/index.module.css b/docs/blocks/header/index.module.css index 3c64ff6..3d5398e 100644 --- a/docs/blocks/header/index.module.css +++ b/docs/blocks/header/index.module.css @@ -13,8 +13,14 @@ .buttons { display: flex; - gap: var(--space-s); + flex-direction: column; + gap: var(--space-l); align-items: center; justify-content: center; margin: var(--space-l) auto; + + @container (inline-size >= 400px) { + flex-direction: row; + gap: var(--space-s); + } } diff --git a/docs/blocks/icons/index.module.css b/docs/blocks/icons/index.module.css index 688540b..b12f5ee 100644 --- a/docs/blocks/icons/index.module.css +++ b/docs/blocks/icons/index.module.css @@ -1,16 +1,31 @@ .icons { padding-block: calc(var(--space-l) * 3); background: var(--color-background-primary); -} - -.container { - display: grid; - grid-template-columns: 5fr 7fr; - gap: var(--space-l); + container-type: inline-size; } .illustration { display: flex; align-items: center; - justify-content: end; +} + +.container { + display: grid; + grid-template-columns: 1fr; + gap: var(--space-xl); + + .illustration { + justify-content: start; + margin-block-start: var(--space-l); + } + + @container (inline-size >= 768px) { + grid-template-columns: 5fr 7fr; + gap: var(--space-l); + + .illustration { + justify-content: end; + margin-block-start: 0; + } + } } diff --git a/docs/blocks/themes/index.module.css b/docs/blocks/themes/index.module.css index 26f3970..46ed113 100644 --- a/docs/blocks/themes/index.module.css +++ b/docs/blocks/themes/index.module.css @@ -5,11 +5,27 @@ var(--color-background-primary) 85%, var(--color-background-secondary) ); + container-type: inline-size; } .container { display: grid; - grid-template-columns: 7fr 5fr; - gap: var(--space-l); + grid-template-columns: 1fr; + gap: var(--space-xl); align-items: center; + + .illustration { + order: 1; + margin-block-start: var(--space-l); + } + + @container (inline-size >= 768px) { + grid-template-columns: 7fr 5fr; + gap: var(--space-l); + + .illustration { + order: 0; + margin-block-start: 0; + } + } } diff --git a/docs/blocks/themes/index.tsx b/docs/blocks/themes/index.tsx index 88e0054..7eb5954 100644 --- a/docs/blocks/themes/index.tsx +++ b/docs/blocks/themes/index.tsx @@ -9,7 +9,7 @@ import styles from './index.module.css' export let Themes = component$(() => (
-
+
diff --git a/docs/elements/illustration-icons/index.module.css b/docs/elements/illustration-icons/index.module.css index a4ccd6b..021b737 100644 --- a/docs/elements/illustration-icons/index.module.css +++ b/docs/elements/illustration-icons/index.module.css @@ -1,3 +1,4 @@ .illustration { + max-inline-size: 100%; block-size: 200px; } diff --git a/docs/elements/illustration-theme/index.module.css b/docs/elements/illustration-theme/index.module.css index be061e9..f2fa7dc 100644 --- a/docs/elements/illustration-theme/index.module.css +++ b/docs/elements/illustration-theme/index.module.css @@ -1,4 +1,5 @@ .illustration { + max-inline-size: 100%; block-size: 260px; padding-block-start: var(--space-l); } diff --git a/docs/elements/netlify/index.module.css b/docs/elements/netlify/index.module.css deleted file mode 100644 index 1d6e4ee..0000000 --- a/docs/elements/netlify/index.module.css +++ /dev/null @@ -1,15 +0,0 @@ -.link { - display: flex; - border-radius: var(--border-radius); - outline: 0; - - &:focus-visible { - box-shadow: 0 0 0 2px var(--color-background-brand); - } -} - -.netlify { - block-size: 50px; - overflow: hidden; - border-radius: var(--border-radius); -} diff --git a/docs/elements/netlify/index.tsx b/docs/elements/netlify/index.tsx deleted file mode 100644 index 2f0fbbb..0000000 --- a/docs/elements/netlify/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { component$ } from '@builder.io/qwik' - -import styles from './index.module.css' - -export let Netlify = component$(() => ( - - - - - - - - - - - - - - -)) diff --git a/docs/elements/theme-dropdown/index.module.css b/docs/elements/theme-dropdown/index.module.css index 4ebbe7b..7c04774 100644 --- a/docs/elements/theme-dropdown/index.module.css +++ b/docs/elements/theme-dropdown/index.module.css @@ -4,21 +4,31 @@ z-index: 1; display: grid; grid-template-rows: repeat( - round(up, calc(var(--total) / var(--columns))), + calc((var(--total) + var(--columns) - 1) / var(--columns)), 1fr ); grid-template-columns: repeat(var(--columns), 1fr); grid-auto-flow: column; gap: var(--space-s) var(--space-xs); - inline-size: 540px; + inline-size: min(calc(100vi - var(--space-s) * 2), 540px); + max-block-size: 460px; padding: var(--space-s) var(--space-xs); + overflow: scroll; background: var(--color-background-primary); border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius); transform: scaleY(0); transform-origin: top center; animation: grow-down 250ms ease-in-out forwards; - --columns: 3; + --columns: 1; + + @media (width >= 400px) { + --columns: 2; + } + + @media (width >= 600px) { + --columns: 3; + } } .dropdown-item { diff --git a/docs/elements/theme-select/index.module.css b/docs/elements/theme-select/index.module.css index dad36e7..5dded71 100644 --- a/docs/elements/theme-select/index.module.css +++ b/docs/elements/theme-select/index.module.css @@ -1,5 +1,6 @@ .wrapper { position: relative; + container-type: inline-size; } .input-wrapper { @@ -11,6 +12,7 @@ inline-size: 100%; padding: calc(var(--space-xs) / 2) var(--space-s); color: var(--color-content-primary); + text-align: start; background: var(--color-background-tertiary); border: 1px solid var(--color-border-secondary); border-radius: var(--border-radius); diff --git a/docs/elements/theme-select/index.tsx b/docs/elements/theme-select/index.tsx index 47fcae0..48b7962 100644 --- a/docs/elements/theme-select/index.tsx +++ b/docs/elements/theme-select/index.tsx @@ -20,14 +20,15 @@ export let ThemeSelect = component$(() => {
- { +