2023-09-26 14:27:38 +08:00
|
|
|
---
|
|
|
|
import Layout from "./Layout.astro";
|
|
|
|
import Navbar from "../components/Navbar.astro";
|
|
|
|
import SideBar from "../components/widget/SideBar.astro";
|
|
|
|
import {pathsEqual} from "../utils/url-utils";
|
2023-09-29 11:58:14 +08:00
|
|
|
import Footer from "../components/Footer.astro";
|
|
|
|
import BackToTop from "../components/control/BackToTop.astro";
|
2023-10-02 01:52:08 +08:00
|
|
|
import DisplaySetting from "../components/widget/DisplaySetting.astro";
|
|
|
|
import {getConfig} from "../utils/config-utils";
|
2023-09-26 14:27:38 +08:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
title: string;
|
2023-10-02 01:52:08 +08:00
|
|
|
banner?: string;
|
2023-09-26 14:27:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const { title, banner } = Astro.props;
|
|
|
|
|
|
|
|
const isHomePage = pathsEqual(Astro.url.pathname, '/') || pathsEqual(Astro.url.pathname, '/page/1');
|
|
|
|
|
|
|
|
|
2023-10-02 01:52:08 +08:00
|
|
|
const enableBanner = getConfig().banner.enable;
|
|
|
|
|
2023-09-26 14:27:38 +08:00
|
|
|
---
|
2023-10-06 03:02:46 +08:00
|
|
|
|
2023-09-26 14:27:38 +08:00
|
|
|
<Layout title={title} banner={banner}>
|
2023-10-11 22:30:20 +08:00
|
|
|
<div class=`max-w-[var(--page-width)] min-h-screen grid grid-cols-[280px_auto] grid-rows-[auto_auto_1fr_auto] lg:grid-rows-[auto_1fr_auto]
|
2023-10-06 03:02:46 +08:00
|
|
|
mx-auto gap-4 relative md:px-4 lg:px-0`
|
2023-09-26 14:27:38 +08:00
|
|
|
transition:animate="none"
|
|
|
|
>
|
2023-10-06 03:02:46 +08:00
|
|
|
<div id="top-row" class="col-span-2 grid-rows-1 z-50" class:list={["transition-all", {
|
|
|
|
'h-[calc(var(--banner-height-home)_-_72px)]': enableBanner && isHomePage,
|
|
|
|
'h-[calc(var(--banner-height)_-_72px)]': enableBanner && !isHomePage,}]}
|
2023-09-26 14:27:38 +08:00
|
|
|
>
|
|
|
|
<Navbar transition:animate="fade" transition:persist></Navbar>
|
|
|
|
</div>
|
2023-10-06 03:02:46 +08:00
|
|
|
<SideBar class="row-start-3 row-end-4 col-span-2 lg:row-start-2 lg:row-end-3 lg:col-span-1 lg:max-w-[280px] " transition:persist></SideBar>
|
2023-09-26 14:27:38 +08:00
|
|
|
|
2023-09-29 11:58:14 +08:00
|
|
|
<div class="row-start-2 row-end-3 col-span-2 lg:col-span-1 overflow-hidden" transition:animate="slide">
|
2023-09-26 14:27:38 +08:00
|
|
|
<!-- the overflow-hidden here prevent long text break the layout-->
|
|
|
|
<slot></slot>
|
2023-09-29 11:58:14 +08:00
|
|
|
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
|
|
|
|
2023-10-02 01:52:08 +08:00
|
|
|
<div class="grid-rows-3 col-span-2 mt-4" transition:persist transition:animate="fade">
|
|
|
|
<Footer transition:persist></Footer>
|
2023-09-29 11:58:14 +08:00
|
|
|
</div>
|
|
|
|
<BackToTop></BackToTop>
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
|
|
|
</Layout>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#top-row {
|
|
|
|
view-transition-name: rrrr;
|
|
|
|
}
|
|
|
|
/* i don't know how this work*/
|
|
|
|
html::view-transition-old(rrrr) {
|
|
|
|
mix-blend-mode: normal;
|
|
|
|
animation: none;
|
|
|
|
height: auto;
|
|
|
|
overflow: clip;
|
|
|
|
object-fit: none;
|
|
|
|
}
|
|
|
|
html::view-transition-new(rrrr) {
|
|
|
|
mix-blend-mode: normal;
|
|
|
|
animation: none;
|
|
|
|
height: auto;
|
|
|
|
overflow: clip;
|
|
|
|
object-fit: none;
|
|
|
|
}
|
2023-10-06 03:02:46 +08:00
|
|
|
</style>
|
|
|
|
<style lang="stylus" is:global>
|
|
|
|
.banner-closed
|
|
|
|
#top-row
|
|
|
|
height: 72px;
|
2023-09-26 14:27:38 +08:00
|
|
|
</style>
|