2023-09-26 14:27:38 +08:00
|
|
|
---
|
|
|
|
import Button from "./control/Button.astro";
|
|
|
|
import { Icon } from 'astro-icon/components';
|
2023-10-02 01:52:08 +08:00
|
|
|
import DisplaySetting from "./widget/DisplaySetting.astro";
|
2023-09-26 14:27:38 +08:00
|
|
|
const className = Astro.props.class;
|
|
|
|
---
|
|
|
|
<div class:list={[
|
|
|
|
className,
|
|
|
|
"card-base max-w-[var(--page-width)] h-[72px] rounded-t-none mx-auto flex items-center justify-between px-4"]}>
|
2023-10-02 01:52:08 +08:00
|
|
|
<a href="/"><Button height="52px" class="px-5 font-bold rounded-lg" light>
|
2023-09-26 14:27:38 +08:00
|
|
|
<div class="flex flex-row text-[var(--primary)] items-center text-md">
|
|
|
|
<Icon name="material-symbols:home-outline-rounded" size={28} class="mb-1 mr-2" />
|
|
|
|
<div class="top-2"></div>Vivia Preview
|
|
|
|
</div>
|
|
|
|
</Button></a>
|
|
|
|
<div>
|
2023-10-02 01:52:08 +08:00
|
|
|
<a href="/"><Button light class="font-bold px-5 rounded-lg">Home</Button></a>
|
|
|
|
<a href="/archive"><Button light class="font-bold px-5 rounded-lg">Archive</Button></a>
|
|
|
|
<a href="/about"><Button light class="font-bold px-5 rounded-lg">About</Button></a>
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
2023-10-02 01:52:08 +08:00
|
|
|
<div class="flex">
|
|
|
|
<div>
|
|
|
|
<Button class="rounded-lg" id="display-settings-switch" iconName="material-symbols:palette-outline" iconSize={20} isIcon light></Button>
|
|
|
|
</div>
|
|
|
|
<div>
|
2023-10-04 18:02:00 +08:00
|
|
|
<Button class="rounded-lg flex items-center justify-center" id="scheme-switch" light height="44px" width="44px">
|
|
|
|
<Icon name="material-symbols:wb-sunny-outline-rounded" size={20} class="absolute opacity-[var(--display-light-icon)]"></Icon>
|
|
|
|
<Icon name="material-symbols:dark-mode-outline-rounded" size={20} class="absolute opacity-[var(--display-dark-icon)]"></Icon>
|
|
|
|
</Button>
|
2023-10-02 01:52:08 +08:00
|
|
|
</div>
|
2023-09-26 14:27:38 +08:00
|
|
|
</div>
|
2023-10-02 01:52:08 +08:00
|
|
|
<DisplaySetting></DisplaySetting>
|
2023-09-26 14:27:38 +08:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="stylus">
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
function switchTheme() {
|
|
|
|
if (localStorage.theme === 'dark') {
|
|
|
|
document.documentElement.classList.remove('dark');
|
|
|
|
localStorage.theme = 'light';
|
|
|
|
} else {
|
|
|
|
document.documentElement.classList.add('dark');
|
|
|
|
localStorage.theme = 'dark';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadThemeSwitchScript() {
|
|
|
|
let switchBtn = document.getElementById("scheme-switch");
|
|
|
|
switchBtn.addEventListener("click", function () {
|
|
|
|
switchTheme()
|
|
|
|
});
|
2023-10-02 01:52:08 +08:00
|
|
|
|
|
|
|
let settingBtn = document.getElementById("display-settings-switch");
|
|
|
|
settingBtn.addEventListener("click", function () {
|
|
|
|
let settingPanel = document.getElementById("display-setting");
|
|
|
|
settingPanel.classList.toggle("closed");
|
|
|
|
});
|
2023-09-26 14:27:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
loadThemeSwitchScript();
|
|
|
|
|
|
|
|
document.addEventListener('astro:after-swap', () => {
|
|
|
|
loadThemeSwitchScript();
|
|
|
|
}, { once: false });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|