fix(web): hide template side-rail on media pages
This commit is contained in:
parent
c2692a0ceb
commit
113c7f2848
|
|
@ -20,6 +20,8 @@ export interface Props {
|
||||||
switchHref?: string;
|
switchHref?: string;
|
||||||
switchLabel?: string;
|
switchLabel?: string;
|
||||||
seo?: PageSeoInput;
|
seo?: PageSeoInput;
|
||||||
|
/** 媒体页只保留 AppShell 侧栏时隐藏模板 side-rail(含左让位) */
|
||||||
|
hideSideRail?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -30,6 +32,7 @@ const {
|
||||||
switchHref,
|
switchHref,
|
||||||
switchLabel,
|
switchLabel,
|
||||||
seo,
|
seo,
|
||||||
|
hideSideRail = false,
|
||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
const brandName = brand ?? t(locale, "meta.brand");
|
const brandName = brand ?? t(locale, "meta.brand");
|
||||||
|
|
@ -125,38 +128,40 @@ const brandInitial = locale === "zh-CN" ? "模" : "A";
|
||||||
<div aria-hidden="true" class="bg-glow pointer-events-none fixed inset-0 z-0"></div>
|
<div aria-hidden="true" class="bg-glow pointer-events-none fixed inset-0 z-0"></div>
|
||||||
<div aria-hidden="true" class="bg-vignette pointer-events-none fixed inset-0 z-0"></div>
|
<div aria-hidden="true" class="bg-vignette pointer-events-none fixed inset-0 z-0"></div>
|
||||||
|
|
||||||
<aside class="side-rail" aria-label={t(locale, "nav.primary")}>
|
{
|
||||||
<a href={brandHref} class="side-rail__brand" aria-label={brandName}>
|
!hideSideRail && (
|
||||||
<span
|
<aside class="side-rail" aria-label={t(locale, "nav.primary")}>
|
||||||
class="brand-signal flex size-8 items-center justify-center text-[12px] font-bold"
|
<a href={brandHref} class="side-rail__brand" aria-label={brandName}>
|
||||||
style="background: var(--edge); color: #101110;"
|
<span
|
||||||
>
|
class="brand-signal flex size-8 items-center justify-center text-[12px] font-bold"
|
||||||
{brandInitial}
|
style="background: var(--edge); color: #101110;"
|
||||||
</span>
|
>
|
||||||
<span class="side-rail__brand-text">{brandName}</span>
|
{brandInitial}
|
||||||
</a>
|
</span>
|
||||||
<div class="side-rail__rule" aria-hidden="true"></div>
|
<span class="side-rail__brand-text">{brandName}</span>
|
||||||
<nav class="side-rail__nav">
|
</a>
|
||||||
<a href={brandHref} class="side-rail__link is-home">
|
<div class="side-rail__rule" aria-hidden="true"></div>
|
||||||
<span class="u-mono">00</span>
|
<nav class="side-rail__nav">
|
||||||
<span>{t(locale, "nav.home")}</span>
|
<a href={brandHref} class="side-rail__link is-home">
|
||||||
</a>
|
<span class="u-mono">00</span>
|
||||||
{
|
<span>{t(locale, "nav.home")}</span>
|
||||||
nav.map((item) => (
|
|
||||||
<a href={item.href} class="side-rail__link">
|
|
||||||
<span class="u-mono">{item.n}</span>
|
|
||||||
<span>{item.label}</span>
|
|
||||||
</a>
|
</a>
|
||||||
))
|
{nav.map((item) => (
|
||||||
}
|
<a href={item.href} class="side-rail__link">
|
||||||
</nav>
|
<span class="u-mono">{item.n}</span>
|
||||||
<div class="side-rail__rule" aria-hidden="true"></div>
|
<span>{item.label}</span>
|
||||||
<div class="side-rail__foot">
|
</a>
|
||||||
<ThemeSwitch client:visible />
|
))}
|
||||||
</div>
|
</nav>
|
||||||
</aside>
|
<div class="side-rail__rule" aria-hidden="true"></div>
|
||||||
|
<div class="side-rail__foot">
|
||||||
|
<ThemeSwitch client:visible />
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
<div class="site-shell">
|
<div class:list={["site-shell", { "site-shell--no-rail": hideSideRail }]}>
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<div class="site-header__inner">
|
<div class="site-header__inner">
|
||||||
<a href={brandHref} class="site-header__brand md:hidden" aria-label={brandName}>
|
<a href={brandHref} class="site-header__brand md:hidden" aria-label={brandName}>
|
||||||
|
|
@ -192,7 +197,7 @@ const brandInitial = locale === "zh-CN" ? "模" : "A";
|
||||||
</a>
|
</a>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<span class="md:hidden">
|
<span class={hideSideRail ? "" : "md:hidden"}>
|
||||||
<ThemeSwitch client:visible />
|
<ThemeSwitch client:visible />
|
||||||
</span>
|
</span>
|
||||||
<UserMenu client:visible locale={locale} />
|
<UserMenu client:visible locale={locale} />
|
||||||
|
|
|
||||||
|
|
@ -471,12 +471,18 @@ html.has-reveal astro-island .u-reveal {
|
||||||
padding-left: 8.5rem;
|
padding-left: 8.5rem;
|
||||||
padding-right: 3.5rem;
|
padding-right: 3.5rem;
|
||||||
}
|
}
|
||||||
|
.site-shell--no-rail {
|
||||||
|
padding-left: 3.5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (min-width: 1280px) {
|
@media (min-width: 1280px) {
|
||||||
.site-shell {
|
.site-shell {
|
||||||
padding-left: 10.5rem;
|
padding-left: 10.5rem;
|
||||||
padding-right: 5rem;
|
padding-right: 5rem;
|
||||||
}
|
}
|
||||||
|
.site-shell--no-rail {
|
||||||
|
padding-left: 5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.site-shell--page {
|
.site-shell--page {
|
||||||
height: 100dvh;
|
height: 100dvh;
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ const labels: Record<string, string> = {
|
||||||
title={t(locale, "mounts.title")}
|
title={t(locale, "mounts.title")}
|
||||||
locale={locale}
|
locale={locale}
|
||||||
nav={[]}
|
nav={[]}
|
||||||
|
hideSideRail
|
||||||
switchHref={alternatePath(Astro.url.pathname, other)}
|
switchHref={alternatePath(Astro.url.pathname, other)}
|
||||||
switchLabel={t(other, `locale.${other}` as never)}
|
switchLabel={t(other, `locale.${other}` as never)}
|
||||||
seo={{
|
seo={{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue