switch to fine and coarse media queries

This commit is contained in:
tresabhi committed 2026-11-20 23:41:12 -06:00
1 parent 68335de62c
commit ca28986730
8 files changed
+29 -35

No files matched your search

@@ -4,13 +4,12 @@ import { CaretUpIcon, GearIcon } from "@radix-ui/react-icons";
import { api } from "../api/dynamic"; import { api } from "../api/dynamic";
import { Logo } from "../icons/Logo"; import { Logo } from "../icons/Logo";
import { LinkI18nWrapper } from "./LinkI18nWrapper"; import { LinkI18nWrapper } from "./LinkI18nWrapper";
import type { Props as NavbarDesktopProps } from "./NavbarDesktop.astro"; import { filtered, type Props as NavbarFineProps } from "./NavbarFine.astro";
import { filtered } from "./NavbarDesktop.astro";
import NavbarMobileAutoHide from "./NavbarMobileAutoHide.astro"; import NavbarMobileAutoHide from "./NavbarMobileAutoHide.astro";
import { Scroller, ScrollerOrientation } from "./Scroller"; import { Scroller, ScrollerOrientation } from "./Scroller";
import { Text } from "./Text"; import { Text } from "./Text";
export type Props = NavbarDesktopProps & { export type Props = NavbarFineProps & {
solid?: boolean; solid?: boolean;
}; };
@@ -27,13 +26,13 @@ const strings = await api.strings(locale);
} }
#navbar-mobile-spacer { #navbar-mobile-spacer {
display: none;
flex-shrink: 0; flex-shrink: 0;
display: none;
height: calc(var(--icon-size) + 2 * var(--padding)); height: calc(var(--icon-size) + 2 * var(--padding));
@media screen and (max-width: 80rem) { @media (pointer: coarse) {
display: block; display: flex;
} }
} }
@@ -59,7 +58,7 @@ const strings = await api.strings(locale);
flex-direction: column; flex-direction: column;
justify-content: flex-end; justify-content: flex-end;
@media screen and (max-width: 80rem) { @media (pointer: coarse) {
display: flex; display: flex;
} }
@@ -27,8 +27,10 @@ export const filtered = Object.values(tools).filter(
--padding: var(--space-4); --padding: var(--space-4);
--min-content-width: calc(var(--icon-size) + 2 * var(--padding)); --min-content-width: calc(var(--icon-size) + 2 * var(--padding));
@media screen and (max-width: 80rem) { display: none;
display: none;
@media (pointer: fine) {
display: block;
} }
width: var(--min-content-width); width: var(--min-content-width);
@@ -10,10 +10,8 @@
height: 100%; height: 100%;
background-color: black; background-color: black;
border-radius: var(--space-4); @media (pointer: fine) {
border-radius: var(--space-4);
@media screen and (max-width: 80rem) {
border-radius: 0;
} }
} }
} }
@@ -7,7 +7,7 @@
display: none; display: none;
@media screen and (max-width: 80rem) { @media (pointer: coarse) {
display: flex; display: flex;
} }
} }
@@ -21,16 +21,13 @@ const toolStrings = strings.tools[tool.id as keyof typeof strings.tools];
--margin: var(--space-4); --margin: var(--space-4);
flex: 1; flex: 1;
border-radius: var(--space-4);
overflow: hidden; overflow: hidden;
margin: var(--margin) var(--margin) 0 0;
background-size: cover; background-size: cover;
@media screen and (max-width: 80rem) { @media (pointer: fine) {
margin: 0; margin: var(--margin) var(--margin) 0 0;
border-radius: 0; border-radius: var(--space-4);
} }
.content { .content {
@@ -3,8 +3,8 @@ import BaseMeta from "../components/BaseMeta.astro";
import BaseStyles from "../components/BaseStyles.astro"; import BaseStyles from "../components/BaseStyles.astro";
import ColorAlias from "../components/ColorAlias.astro"; import ColorAlias from "../components/ColorAlias.astro";
import ColorScale from "../components/ColorScale.astro"; import ColorScale from "../components/ColorScale.astro";
import NavbarDesktop from "../components/NavbarDesktop.astro"; import NavbarCourse from "../components/NavbarCourse.astro";
import NavbarMobile from "../components/NavbarMobile.astro"; import NavbarFine from "../components/NavbarFine.astro";
import SystemTheme from "../components/SystemTheme.astro"; import SystemTheme from "../components/SystemTheme.astro";
import { tools } from "../constants/tools"; import { tools } from "../constants/tools";
import type { LocaleAcceptorProps } from "../hooks/useLocale"; import type { LocaleAcceptorProps } from "../hooks/useLocale";
@@ -53,7 +53,11 @@ const tool = tools.tanks;
min-height: 100dvh; min-height: 100dvh;
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: column;
@media (pointer: fine) {
flex-direction: row-reverse;
}
background-color: var(--gray-1); background-color: var(--gray-1);
color: var(--gray-12); color: var(--gray-12);
@@ -66,10 +70,6 @@ const tool = tools.tanks;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
@media screen and (max-width: 80rem) {
flex-direction: column;
}
} }
</style> </style>
</head> </head>
@@ -79,7 +79,7 @@ const tool = tools.tanks;
<slot /> <slot />
</main> </main>
<NavbarDesktop {locale} {tool} /> <NavbarFine {locale} {tool} />
<NavbarMobile {locale} {tool} solid={solidNavbar} /> <NavbarCourse {locale} {tool} solid={solidNavbar} />
</body> </body>
</html> </html>
@@ -6,7 +6,7 @@
padding: var(--space-4); padding: var(--space-4);
padding-left: 0; padding-left: 0;
@media screen and (max-width: 80rem) { @media (pointer: coarse) {
padding-left: var(--space-4); padding-left: var(--space-4);
} }
@@ -7,10 +7,8 @@
.sandbox { .sandbox {
flex-grow: 1; flex-grow: 1;
padding-top: var(--space-4); @media (pointer: fine) {
padding-top: var(--space-4);
@media screen and (max-width: 80rem) {
padding-top: 0;
} }
} }
@@ -34,7 +32,7 @@
} }
} }
@media screen and (max-width: 80rem) { @media (pointer: coarse) {
.sandbox, .sandbox,
.loadout { .loadout {
&[data-tabbed="false"] { &[data-tabbed="false"] {