mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-29 04:44:23 +01:00
fancy navbar
This commit is contained in:
17 files changed
+422
-198
No files matched your search
@@ -73,6 +73,10 @@ styles += "}";
|
||||
--duration-brief: 200ms;
|
||||
--duration-subtle: 2s;
|
||||
--duration-spinner: 1s;
|
||||
/* Gap between consecutive items in a staggered entrance */
|
||||
--duration-stagger: 20ms;
|
||||
|
||||
--easing-standard: cubic-bezier(0.4, 0, 0.6, 1);
|
||||
|
||||
--tank-card-min-width: 8rem;
|
||||
--drop-down-min-width: 16rem;
|
||||
@@ -81,6 +85,11 @@ styles += "}";
|
||||
</style>
|
||||
|
||||
<style is:global>
|
||||
/* Zero specificity, so any component's own timing function still wins */
|
||||
* {
|
||||
transition-timing-function: var(--easing-standard);
|
||||
}
|
||||
|
||||
.composable-radius {
|
||||
&[data-radius="1"] {
|
||||
border-radius: var(--space-3);
|
||||
|
||||
@@ -13,11 +13,28 @@ const { locale } = Astro.props;
|
||||
|
||||
const strings = await api.strings(locale);
|
||||
|
||||
// Meteorological seasons, starting at december
|
||||
const SEASONS = ["winter", "spring", "summer", "fall"];
|
||||
// Seasons start a month early, so winter covers november to january
|
||||
const SEASONS = [
|
||||
{
|
||||
name: "winter",
|
||||
position: "bottom",
|
||||
},
|
||||
{
|
||||
name: "spring",
|
||||
position: "bottom",
|
||||
},
|
||||
{
|
||||
name: "summer",
|
||||
position: "bottom",
|
||||
},
|
||||
{
|
||||
name: "fall",
|
||||
position: "bottom",
|
||||
},
|
||||
];
|
||||
|
||||
const month = new Date().getMonth();
|
||||
const season = SEASONS[Math.floor(((month + 1) % 12) / 3)];
|
||||
const season = SEASONS[Math.floor(((month + 2) % 12) / 3)];
|
||||
---
|
||||
|
||||
<style>
|
||||
@@ -62,7 +79,8 @@ const season = SEASONS[Math.floor(((month + 1) % 12) / 3)];
|
||||
<section
|
||||
class="wrapper"
|
||||
style={{
|
||||
backgroundImage: `url(${alias("api", `/hero/${season}.webp`)})`,
|
||||
backgroundPosition: season.position,
|
||||
backgroundImage: `url(${alias("api", `/hero/${season.name}.webp`)})`,
|
||||
}}
|
||||
>
|
||||
<div class="blur"></div>
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { CaretUpIcon, GearIcon } from "@radix-ui/react-icons";
|
||||
import { api } from "../api/dynamic";
|
||||
import { tools, type Tool } from "../config/tools";
|
||||
import { getLocaleOptions } from "../core/i18n/getLocaleOptions";
|
||||
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
||||
import { Logo } from "../icons/Logo";
|
||||
import { LinkI18nWrapper } from "./LinkI18nWrapper";
|
||||
import { filtered, type Props as NavbarFineProps } from "./NavbarFine.astro";
|
||||
import NavbarMobileAutoHide from "./NavbarMobileAutoHide.astro";
|
||||
import { Scroller, ScrollerOrientation } from "./Scroller";
|
||||
import { SettingsDialog } from "./SettingsDialog";
|
||||
import { Text } from "./Text";
|
||||
|
||||
export type Props = NavbarFineProps & {
|
||||
export type Props = LocaleAcceptorProps & {
|
||||
tool: Tool;
|
||||
solid?: boolean;
|
||||
};
|
||||
|
||||
@@ -19,6 +21,10 @@ const { locale, tool, solid = false } = Astro.props;
|
||||
|
||||
const strings = await api.strings(locale);
|
||||
const localeOptions = await getLocaleOptions();
|
||||
|
||||
const filtered = Object.values(tools).filter(
|
||||
(tool) => !tool.href && !tool.hide_in_navbar && !tool.disabled,
|
||||
);
|
||||
---
|
||||
|
||||
<style>
|
||||
@@ -46,7 +52,7 @@ const localeOptions = await getLocaleOptions();
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
|
||||
z-index: 2;
|
||||
z-index: 1;
|
||||
|
||||
background-color: var(--black-a9);
|
||||
backdrop-filter: var(--blur-tint);
|
||||
@@ -183,7 +189,7 @@ const localeOptions = await getLocaleOptions();
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
|
||||
#navbar-mobile[data-expanded="true"] ~ & {
|
||||
&[data-expanded="true"] {
|
||||
pointer-events: auto;
|
||||
background-color: var(--black-a8);
|
||||
}
|
||||
@@ -200,14 +206,20 @@ const localeOptions = await getLocaleOptions();
|
||||
const overlay = document.getElementById("navbar-mobile-overlay")!;
|
||||
|
||||
tool.addEventListener("click", () => {
|
||||
navbar.dataset.expanded = `${navbar.dataset.expanded !== "true"}`;
|
||||
const expanded = `${navbar.dataset.expanded !== "true"}`;
|
||||
|
||||
navbar.dataset.expanded = expanded;
|
||||
overlay.dataset.expanded = expanded;
|
||||
});
|
||||
|
||||
overlay.addEventListener("pointerdown", () => {
|
||||
navbar.dataset.expanded = "false";
|
||||
overlay.dataset.expanded = "false";
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="navbar-mobile-overlay" data-expanded="false" />
|
||||
|
||||
<nav
|
||||
id="navbar-mobile"
|
||||
data-visible="true"
|
||||
@@ -269,8 +281,6 @@ const localeOptions = await getLocaleOptions();
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div id="navbar-mobile-overlay" />
|
||||
|
||||
{solid && <div id="navbar-mobile-spacer" />}
|
||||
|
||||
{!solid && <NavbarMobileAutoHide />}
|
||||
@@ -2,35 +2,45 @@
|
||||
import { alias } from "@blitzkit/core";
|
||||
import { GearIcon } from "@radix-ui/react-icons";
|
||||
import { api } from "../api/dynamic";
|
||||
import { toolGroups, tools } from "../config/tools";
|
||||
import { getLocaleOptions } from "../core/i18n/getLocaleOptions";
|
||||
import { tools, type Tool } from "../config/tools";
|
||||
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
||||
import { Logo } from "../icons/Logo";
|
||||
import { LinkI18nWrapper } from "./LinkI18nWrapper";
|
||||
import { SettingsDialog } from "./SettingsDialog";
|
||||
import { Text } from "./Text";
|
||||
|
||||
// TODO: combine all navbar after adding NavbarCourseLandscape
|
||||
|
||||
export type Props = LocaleAcceptorProps & {
|
||||
tool: Tool;
|
||||
};
|
||||
export type Props = LocaleAcceptorProps;
|
||||
|
||||
const { locale } = Astro.props;
|
||||
|
||||
const strings = await api.strings(locale);
|
||||
const localeOptions = await getLocaleOptions();
|
||||
|
||||
export const filtered = Object.values(tools).filter(
|
||||
(tool) => !tool.href && !tool.hide_in_navbar && !tool.disabled,
|
||||
);
|
||||
// TODO: restore filtering out disabled tools and empty groups after testing
|
||||
const groups = toolGroups.map((group) => {
|
||||
const name = strings.home[group.id as keyof typeof strings.home];
|
||||
const fallback = tools[group.default];
|
||||
const href = `/${fallback.slug ?? fallback.id}`;
|
||||
|
||||
return {
|
||||
...group,
|
||||
|
||||
name,
|
||||
href,
|
||||
tools: group.tools.map((id) => tools[id]),
|
||||
};
|
||||
});
|
||||
---
|
||||
|
||||
<style>
|
||||
#navbar-desktop {
|
||||
#navbar-fine {
|
||||
--icon-size: 1.5rem;
|
||||
--padding: var(--page-padding);
|
||||
--min-content-width: calc(var(--icon-size) + 2 * var(--padding));
|
||||
--padding: var(--space-4);
|
||||
--content-inset: max(
|
||||
var(--page-padding),
|
||||
(100% - var(--page-width)) / 2
|
||||
);
|
||||
|
||||
display: none;
|
||||
|
||||
@@ -38,170 +48,307 @@ export const filtered = Object.values(tools).filter(
|
||||
display: block;
|
||||
}
|
||||
|
||||
width: var(--min-content-width);
|
||||
height: 100dvh;
|
||||
|
||||
position: sticky;
|
||||
top: 0;
|
||||
|
||||
z-index: 1;
|
||||
|
||||
.expander {
|
||||
background-color: var(--gray-1);
|
||||
|
||||
z-index: 1;
|
||||
|
||||
position: relative;
|
||||
left: 0;
|
||||
|
||||
.bar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-4);
|
||||
|
||||
box-sizing: border-box;
|
||||
padding: var(--padding) var(--content-inset);
|
||||
|
||||
background-color: var(--black-a9);
|
||||
backdrop-filter: var(--blur-tint);
|
||||
border-bottom: var(--space-0) solid var(--white-a1);
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
|
||||
height: 100%;
|
||||
width: var(--min-content-width);
|
||||
overflow: hidden;
|
||||
|
||||
padding: calc(var(--padding) + 2 * var(--space-2)) var(--padding);
|
||||
|
||||
border-right: 0 solid var(--gray-4);
|
||||
|
||||
&:hover {
|
||||
width: fit-content;
|
||||
border-right: var(--space-0) solid var(--gray-4);
|
||||
#navbar-fine[data-open="true"] & {
|
||||
border-bottom-color: transparent;
|
||||
}
|
||||
|
||||
.logo {
|
||||
.icon {
|
||||
display: block;
|
||||
|
||||
width: var(--icon-size);
|
||||
height: var(--icon-size);
|
||||
|
||||
color: var(--gray-11);
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
|
||||
&:hover {
|
||||
color: var(--gray-12);
|
||||
}
|
||||
}
|
||||
|
||||
.named-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
|
||||
.icon {
|
||||
flex-shrink: 0;
|
||||
|
||||
width: var(--icon-size);
|
||||
height: var(--icon-size);
|
||||
|
||||
.trigger {
|
||||
.name {
|
||||
color: var(--gray-11);
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
}
|
||||
|
||||
.expander:hover & {
|
||||
color: var(--gray-12);
|
||||
&:hover .name,
|
||||
&[data-open="true"] .name {
|
||||
color: var(--gray-12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.flyout {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
height: 0;
|
||||
|
||||
background-color: var(--black-a9);
|
||||
backdrop-filter: var(--blur-tint);
|
||||
border-bottom: 0 solid var(--white-a1);
|
||||
|
||||
transition-property: height, border-bottom-width;
|
||||
|
||||
#navbar-fine[data-open="true"] & {
|
||||
border-bottom-width: var(--space-0);
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
gap: var(--space-4);
|
||||
|
||||
padding: var(--space-5) var(--content-inset) var(--space-6);
|
||||
|
||||
&[data-active="true"] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.header,
|
||||
.tool {
|
||||
transition-duration: var(--duration-brief);
|
||||
transition-delay: calc(var(--index, 0) * var(--duration-stagger));
|
||||
|
||||
@starting-style {
|
||||
opacity: 0;
|
||||
translate: 0 calc(-1 * var(--space-2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
transition-duration: var(--duration-brief);
|
||||
white-space: nowrap;
|
||||
|
||||
.expander:not(:hover) & {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.tools {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
|
||||
.tool {
|
||||
.tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
|
||||
.logo {
|
||||
flex-shrink: 0;
|
||||
.tool {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
.thumbnail {
|
||||
flex-shrink: 0;
|
||||
|
||||
width: var(--icon-size);
|
||||
height: var(--icon-size);
|
||||
|
||||
filter: opacity(0.75);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
|
||||
border-radius: var(--radius-max);
|
||||
|
||||
.expander:hover & {
|
||||
width: calc(2 * var(--icon-size));
|
||||
height: var(--icon-size);
|
||||
|
||||
filter: opacity(1);
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
|
||||
border-radius: var(--radius-max);
|
||||
}
|
||||
|
||||
.name {
|
||||
color: var(--gray-12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
#navbar-fine-curtain {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
|
||||
background-color: transparent;
|
||||
background-color: transparent;
|
||||
backdrop-filter: blur(0);
|
||||
|
||||
transition-duration: var(--duration-brief);
|
||||
transition-duration: var(--duration-brief);
|
||||
|
||||
#navbar-desktop:hover & {
|
||||
background-color: var(--black-a8);
|
||||
}
|
||||
&[data-open="true"] {
|
||||
pointer-events: auto;
|
||||
|
||||
background-color: var(--black-a8);
|
||||
backdrop-filter: blur(var(--space-3));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<nav id="navbar-desktop">
|
||||
<div class="overlay" />
|
||||
<script>
|
||||
// Mirrors apple.com's global nav: hover intent before opening, and a
|
||||
// collapse duration that scales with the flyout's height
|
||||
const HOVER_DELAY = 120;
|
||||
const MIN_DURATION = 240;
|
||||
const MAX_DURATION = 480;
|
||||
|
||||
<div class="expander">
|
||||
const navbar = document.getElementById("navbar-fine")!;
|
||||
const curtain = document.getElementById("navbar-fine-curtain")!;
|
||||
const flyout = navbar.querySelector<HTMLElement>(".flyout")!;
|
||||
const triggers = navbar.querySelectorAll<HTMLElement>(".trigger");
|
||||
const panels = navbar.querySelectorAll<HTMLElement>(".panel");
|
||||
const icons = navbar.querySelectorAll<HTMLElement>(".bar .icon");
|
||||
|
||||
let hoverTimeout: number | undefined;
|
||||
|
||||
function resize(height: number) {
|
||||
const duration = Math.min(MAX_DURATION, Math.max(MIN_DURATION, height / 2));
|
||||
|
||||
flyout.style.transitionDuration = `${duration}ms`;
|
||||
flyout.style.height = `${height}px`;
|
||||
}
|
||||
|
||||
function open(group: string) {
|
||||
let height = 0;
|
||||
|
||||
navbar.dataset.open = "true";
|
||||
curtain.dataset.open = "true";
|
||||
|
||||
for (const trigger of triggers) {
|
||||
trigger.dataset.open = `${trigger.dataset.group === group}`;
|
||||
}
|
||||
|
||||
for (const panel of panels) {
|
||||
const active = panel.dataset.group === group;
|
||||
|
||||
panel.dataset.active = `${active}`;
|
||||
if (active) height = panel.offsetHeight;
|
||||
}
|
||||
|
||||
resize(height);
|
||||
}
|
||||
|
||||
function close() {
|
||||
clearTimeout(hoverTimeout);
|
||||
|
||||
if (navbar.dataset.open !== "true") return;
|
||||
|
||||
navbar.dataset.open = "false";
|
||||
curtain.dataset.open = "false";
|
||||
|
||||
for (const trigger of triggers) trigger.dataset.open = "false";
|
||||
|
||||
resize(0);
|
||||
}
|
||||
|
||||
for (const trigger of triggers) {
|
||||
const group = trigger.dataset.group!;
|
||||
|
||||
trigger.addEventListener("mouseenter", () => {
|
||||
clearTimeout(hoverTimeout);
|
||||
hoverTimeout = window.setTimeout(() => open(group), HOVER_DELAY);
|
||||
});
|
||||
|
||||
trigger.addEventListener("mouseleave", () => {
|
||||
clearTimeout(hoverTimeout);
|
||||
});
|
||||
}
|
||||
|
||||
for (const icon of icons) {
|
||||
icon.addEventListener("mouseenter", () => {
|
||||
clearTimeout(hoverTimeout);
|
||||
hoverTimeout = window.setTimeout(close, HOVER_DELAY);
|
||||
});
|
||||
}
|
||||
|
||||
// Panels stay mounted while collapsing; unmount them after so the next
|
||||
// open replays the staggered fade in
|
||||
flyout.addEventListener("transitionend", (event) => {
|
||||
if (event.target !== flyout || navbar.dataset.open === "true") return;
|
||||
|
||||
for (const panel of panels) panel.dataset.active = "false";
|
||||
});
|
||||
|
||||
navbar.addEventListener("mouseleave", close);
|
||||
curtain.addEventListener("pointerdown", close);
|
||||
window.addEventListener("scroll", close, { passive: true });
|
||||
|
||||
navbar.addEventListener("focusout", (event) => {
|
||||
if (navbar.contains(event.relatedTarget as Node | null)) return;
|
||||
|
||||
close();
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (event) => {
|
||||
if (event.key !== "Escape" || navbar.dataset.open !== "true") return;
|
||||
|
||||
const trigger = navbar.querySelector<HTMLElement>(
|
||||
'.trigger[data-open="true"]',
|
||||
);
|
||||
|
||||
close();
|
||||
trigger!.closest("a")!.focus();
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="navbar-fine-curtain" data-open="false"></div>
|
||||
|
||||
<nav id="navbar-fine" data-open="false">
|
||||
<div class="bar">
|
||||
<LinkI18nWrapper {locale} href="/">
|
||||
<div class="named-link">
|
||||
<Logo className="icon" />
|
||||
<Text className="name">{strings.navbar.home}</Text>
|
||||
</div>
|
||||
<Logo className="icon" />
|
||||
</LinkI18nWrapper>
|
||||
|
||||
<div class="tools">
|
||||
{filtered
|
||||
.filter((tool) => !tool.hide_in_navbar_desktop)
|
||||
.map((tool) => (
|
||||
<>
|
||||
{groups.map((group) => (
|
||||
<LinkI18nWrapper {locale} href={group.href}>
|
||||
<span class="trigger" data-group={group.id} data-open="false">
|
||||
<Text size="minor" className="name">
|
||||
{group.name}
|
||||
</Text>
|
||||
</span>
|
||||
</LinkI18nWrapper>
|
||||
))}
|
||||
|
||||
<SettingsDialog {locale} {localeOptions} client:load>
|
||||
<GearIcon className="icon" />
|
||||
</SettingsDialog>
|
||||
</div>
|
||||
|
||||
<div class="flyout">
|
||||
{groups.map((group) => (
|
||||
<div class="panel" data-group={group.id} data-active="false">
|
||||
<Text size="minor" lowContrast className="header">
|
||||
{group.name}
|
||||
</Text>
|
||||
|
||||
<div class="tools">
|
||||
{group.tools.map((tool, index) => (
|
||||
<LinkI18nWrapper {locale} href={`/${tool.slug ?? tool.id}`}>
|
||||
<div class="tool">
|
||||
<div class="tool" style={`--index: ${index + 1}`}>
|
||||
<div
|
||||
class="thumbnail"
|
||||
style={`background-image: url(${alias(
|
||||
"api",
|
||||
`/tools/${tool.id}/banners/thumbnail.webp`,
|
||||
)})`}
|
||||
class="logo"
|
||||
/>
|
||||
|
||||
<Text className="name">
|
||||
<Text size="major" weight="medium" className="name">
|
||||
{strings.tools[tool.id as keyof typeof strings.tools]}
|
||||
</Text>
|
||||
</div>
|
||||
</LinkI18nWrapper>
|
||||
</>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<SettingsDialog {locale} {localeOptions} client:load>
|
||||
<div class="named-link">
|
||||
<GearIcon className="icon" />
|
||||
<Text className="name">{strings.navbar.settings}</Text>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</SettingsDialog>
|
||||
))}
|
||||
</div>
|
||||
</nav>
|
||||
@@ -2,22 +2,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
padding-right: var(--page-padding);
|
||||
|
||||
/* astro island's children sometimes end up being first deeper into the div's */
|
||||
&:first-child:not(astro-island > &) {
|
||||
padding-top: var(--page-padding);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
flex: 1;
|
||||
padding-bottom: var(--page-padding);
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
padding-left: var(--page-padding);
|
||||
}
|
||||
|
||||
&[data-overflow="true"] {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<style>
|
||||
.sections {
|
||||
flex: 1;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--page-padding);
|
||||
|
||||
padding: 0 var(--page-padding) var(--page-padding);
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="sections">
|
||||
<slot />
|
||||
</div>
|
||||
@@ -18,17 +18,11 @@ const name = strings.tools[tool.id as keyof typeof strings.tools];
|
||||
<style>
|
||||
.tool-banner {
|
||||
--tool-banner-overlap: 8rem;
|
||||
--margin: var(--space-4);
|
||||
|
||||
overflow: hidden;
|
||||
|
||||
background-size: cover;
|
||||
|
||||
@media (pointer: fine) {
|
||||
border-radius: var(--space-4);
|
||||
margin: var(--page-padding) var(--page-padding) 0 0;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
@@ -10,7 +10,6 @@ export interface Tool {
|
||||
|
||||
banner_background_position: "top" | "center" | "bottom";
|
||||
hide_in_navbar?: boolean;
|
||||
hide_in_navbar_desktop?: boolean;
|
||||
}
|
||||
|
||||
export const tools: Record<string, Tool> = {
|
||||
@@ -18,7 +17,6 @@ export const tools: Record<string, Tool> = {
|
||||
id: "home",
|
||||
slug: "",
|
||||
banner_background_position: "center",
|
||||
hide_in_navbar_desktop: true,
|
||||
},
|
||||
tanks: {
|
||||
id: "tanks",
|
||||
@@ -97,6 +95,42 @@ export const tools: Record<string, Tool> = {
|
||||
},
|
||||
};
|
||||
|
||||
export interface ToolGroup {
|
||||
// Key into strings.home, which titles the group on the home page
|
||||
id: string;
|
||||
// Where clicking the group's title in the navbar goes
|
||||
default: string;
|
||||
tools: string[];
|
||||
}
|
||||
|
||||
export const toolGroups: ToolGroup[] = [
|
||||
{
|
||||
id: "tanks",
|
||||
default: "tanks",
|
||||
tools: ["tanks", "compare", "performance", "tier_list"],
|
||||
},
|
||||
{
|
||||
id: "players",
|
||||
default: "players",
|
||||
tools: ["players", "session", "embed", "playlist"],
|
||||
},
|
||||
{
|
||||
id: "games",
|
||||
default: "mixer",
|
||||
tools: ["mixer", "guesser"],
|
||||
},
|
||||
{
|
||||
id: "cosmetics",
|
||||
default: "avatars",
|
||||
tools: ["avatars", "backgrounds"],
|
||||
},
|
||||
{
|
||||
id: "technical",
|
||||
default: "api",
|
||||
tools: ["api", "changelogs"],
|
||||
},
|
||||
];
|
||||
|
||||
export enum ToolBannerSize {
|
||||
Thumbnail = "thumbnail",
|
||||
Poster = "poster",
|
||||
|
||||
@@ -58,10 +58,6 @@ const { locale, accent, solidNavbar = false, tool } = Astro.props;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@media (pointer: fine) {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
background-color: var(--gray-1);
|
||||
color: var(--gray-12);
|
||||
font-family: var(--font-family-regular);
|
||||
@@ -70,6 +66,9 @@ const { locale, accent, solidNavbar = false, tool } = Astro.props;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
/* Contains the page's own z-index: 1 layers so they can't rise over the navbars */
|
||||
isolation: isolate;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -80,13 +79,14 @@ const { locale, accent, solidNavbar = false, tool } = Astro.props;
|
||||
</head>
|
||||
|
||||
<body data-solid-navbar={solidNavbar}>
|
||||
<NavbarFine {locale} />
|
||||
|
||||
<main class="main">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
<AutoFocus />
|
||||
|
||||
<NavbarFine {locale} {tool} />
|
||||
<NavbarCourse {locale} {tool} solid={solidNavbar} />
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 325 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 322 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 308 KiB |
@@ -4,6 +4,7 @@ import { CompareControls } from "../../../../components/CompareControls";
|
||||
import { CompareTable } from "../../../../components/CompareTable";
|
||||
import CompareURLManager from "../../../../components/CompareURLManager.astro";
|
||||
import { Section } from "../../../../components/Section";
|
||||
import Sections from "../../../../components/Sections.astro";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
@@ -30,13 +31,15 @@ const { locale } = Astro.props;
|
||||
<ToolBanner tool={tools.compare} {locale} />
|
||||
<CompareURLManager />
|
||||
|
||||
<Section>
|
||||
<div class="controls">
|
||||
<CompareControls {locale} client:load />
|
||||
</div>
|
||||
</Section>
|
||||
<Sections>
|
||||
<Section>
|
||||
<div class="controls">
|
||||
<CompareControls {locale} client:load />
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<Section overflow>
|
||||
<CompareTable {locale} client:load />
|
||||
</Section>
|
||||
<Section overflow>
|
||||
<CompareTable {locale} client:load />
|
||||
</Section>
|
||||
</Sections>
|
||||
</BaseLayout>
|
||||
@@ -3,7 +3,7 @@ import { assertSecret } from "@blitzkit/core";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
import { mixStaticPaths } from "../../../astro/mixStaticPaths";
|
||||
import HomeHero from "../../../components/HomeHero.astro";
|
||||
import HomeTanks from "../../../components/HomeTanks.astro";
|
||||
import Sections from "../../../components/Sections.astro";
|
||||
import { tools, type Tool } from "../../../config/tools";
|
||||
import BaseLayout from "../../../layouts/BaseLayout.astro";
|
||||
import { getStaticPaths as _getStaticPaths } from "../_index";
|
||||
@@ -47,11 +47,13 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, () => {
|
||||
|
||||
<!-- {environment === "preview" && <AesonPlug />} -->
|
||||
|
||||
<HomeTanks {locale} />
|
||||
<!-- <HomePlayers {locale} /> -->
|
||||
<!-- <HomeGames {locale} /> -->
|
||||
<!-- <HomeCosmetics {locale} /> -->
|
||||
<!-- <HomeTechnical {locale} /> -->
|
||||
<Sections>
|
||||
<!-- <HomeTanks {locale} /> -->
|
||||
<!-- <HomePlayers {locale} /> -->
|
||||
<!-- <HomeGames {locale} /> -->
|
||||
<!-- <HomeCosmetics {locale} /> -->
|
||||
<!-- <HomeTechnical {locale} /> -->
|
||||
</Sections>
|
||||
</BaseLayout>
|
||||
|
||||
<!-- TODO: read temp/notes.md for user testing fixes -->
|
||||
@@ -6,6 +6,7 @@ import { Section } from "../../../../components/Section";
|
||||
import { TankSearchBar } from "../../../../components/TankSearchBar";
|
||||
import { TankSearchFilters } from "../../../../components/TankSearchFilters";
|
||||
import { TankSearchResults } from "../../../../components/TankSearchResults";
|
||||
import Sections from "../../../../components/Sections.astro";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tools } from "../../../../config/tools";
|
||||
import BaseLayout from "../../../../layouts/BaseLayout.astro";
|
||||
@@ -22,21 +23,23 @@ const { locale } = Astro.props;
|
||||
<BaseLayout tool={tools.tanks} {locale} accent="purple">
|
||||
<ToolBanner {locale} tool={tools.tanks} />
|
||||
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<RecentlyViewedTanks {locale} client:load />
|
||||
</Section>
|
||||
<Sections>
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<RecentlyViewedTanks {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TankSearchBar {locale} client:load />
|
||||
</Section>
|
||||
<Section>
|
||||
<TankSearchBar {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<TankSearchFilters {locale} client:load />
|
||||
</Section>
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<TankSearchFilters {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TankSearchResults {locale} client:load />
|
||||
</Section>
|
||||
<Section>
|
||||
<TankSearchResults {locale} client:load />
|
||||
</Section>
|
||||
</Sections>
|
||||
</BaseLayout>
|
||||
@@ -6,6 +6,7 @@ import { TankSearchFilters } from "../../../../components/TankSearchFilters";
|
||||
import { TierListControls } from "../../../../components/TierListControls";
|
||||
import { TierListTable } from "../../../../components/TierListTable";
|
||||
import { TierListTiles } from "../../../../components/TierListTiles";
|
||||
import Sections from "../../../../components/Sections.astro";
|
||||
import TierListURLManager from "../../../../components/TierListURLManager.astro";
|
||||
import ToolBanner from "../../../../components/ToolBanner.astro";
|
||||
import { tierListColors } from "../../../../config/tierList";
|
||||
@@ -26,20 +27,22 @@ const { locale } = Astro.props;
|
||||
<ToolBanner tool={tools.tier_list} {locale} />
|
||||
<TierListURLManager />
|
||||
|
||||
<Section>
|
||||
<TierListControls {locale} client:load />
|
||||
</Section>
|
||||
<Sections>
|
||||
<Section>
|
||||
<TierListControls {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TierListTable {locale} client:load />
|
||||
</Section>
|
||||
<Section>
|
||||
<TierListTable {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<TankSearchFilters {locale} client:load />
|
||||
</Section>
|
||||
<Section overflow>
|
||||
<ScrollerCurtains client:load />
|
||||
<TankSearchFilters {locale} client:load />
|
||||
</Section>
|
||||
|
||||
<Section>
|
||||
<TierListTiles {locale} client:load />
|
||||
</Section>
|
||||
<Section>
|
||||
<TierListTiles {locale} client:load />
|
||||
</Section>
|
||||
</Sections>
|
||||
</BaseLayout>
|
||||
Reference in new issue
Block a user