mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-11 18:56:06 +09:00
73 lines
1.9 KiB
Plaintext
73 lines
1.9 KiB
Plaintext
---
|
|
import config from "@/config/config.json";
|
|
import ImageMod from "./ImageMod.astro";
|
|
import { getLangFromUrl, slugSelector } from "@/lib/utils/languageParser";
|
|
|
|
const { src, srcDarkmode }: { src?: string; srcDarkmode?: string } =
|
|
Astro.props;
|
|
const {
|
|
logo,
|
|
logo_darkmode,
|
|
logo_width,
|
|
logo_height,
|
|
logo_text,
|
|
title,
|
|
}: {
|
|
logo: string;
|
|
logo_darkmode: string;
|
|
logo_width: any;
|
|
logo_height: any;
|
|
logo_text: string;
|
|
title: string;
|
|
} = config.site;
|
|
|
|
const { theme_switcher }: { theme_switcher: boolean } = config.settings;
|
|
const { default_language } = config.settings;
|
|
|
|
let lang = getLangFromUrl(Astro.url);
|
|
|
|
const disabledLanguages = config.settings.disable_languages as string[];
|
|
if (disabledLanguages.includes(lang)) {
|
|
lang = default_language;
|
|
}
|
|
---
|
|
|
|
<a href={slugSelector("/", lang)} class="navbar-brand inline-block">
|
|
{
|
|
src || srcDarkmode || logo || logo_darkmode ? (
|
|
<>
|
|
<ImageMod
|
|
src={src ? src : logo}
|
|
class={`inline-block ${theme_switcher && "dark:hidden"}`}
|
|
width={logo_width.replace("px", "") * 2}
|
|
height={logo_height.replace("px", "") * 2}
|
|
alt={title}
|
|
style={{
|
|
height: logo_height.replace("px", "") + "px",
|
|
width: logo_width.replace("px", "") + "px",
|
|
}}
|
|
format="webp"
|
|
/>
|
|
{theme_switcher && (
|
|
<ImageMod
|
|
src={srcDarkmode ? srcDarkmode : logo_darkmode}
|
|
class={"hidden dark:inline-block"}
|
|
width={logo_width.replace("px", "") * 2}
|
|
height={logo_height.replace("px", "") * 2}
|
|
alt={title}
|
|
style={{
|
|
height: logo_height.replace("px", "") + "px",
|
|
width: logo_width.replace("px", "") + "px",
|
|
}}
|
|
format="webp"
|
|
/>
|
|
)}
|
|
</>
|
|
) : logo_text ? (
|
|
logo_text
|
|
) : (
|
|
title
|
|
)
|
|
}
|
|
</a>
|