feat: support alternative logos like png

closes #442
This commit is contained in:
Mathias Schopmans
2024-03-26 09:22:03 +01:00
parent 969306c794
commit d254ec1af6
6 changed files with 20 additions and 9 deletions

View File

@@ -1,14 +1,14 @@
import logo from "../../../public/logo.svg";
import styles from "./Footer.module.css";
import { SocialLinks } from "@/components/SocialLinks/SocialLinks";
import { getAppName, getImprintUrl, getLabel } from "@/lib/data";
import { getAppName, getImprintUrl, getLabel, getLogoUrl } from "@/lib/data";
export function Footer() {
const logoUrl = getLogoUrl();
return (
<div className={styles.footer}>
<div className={styles.branding}>
<img src={logo.src} className={styles.logo} alt={getAppName()} />
<img src={logoUrl} className={styles.logo} alt={getAppName()} />
<p className={styles.description}>{getLabel("footer")}</p>
<SocialLinks className={styles.socialLinks} />
</div>

View File

@@ -3,18 +3,19 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import logo from "../../../public/logo.svg";
import styles from "./Logo.module.css";
import { getAppName } from "@/lib/data";
import { getAppName, getLogoUrl } from "@/lib/data";
import { cn } from "@/lib/utils";
export function Logo() {
const pathname = usePathname();
const appName = getAppName();
const logoUrl = getLogoUrl();
return (
<Link href="/" className={cn(styles.logo, pathname != "/" && styles.small)}>
<img src={logo.src} className={cn(styles.src)} alt={appName} />
<img src={logoUrl} className={cn(styles.src)} alt={appName} />
<span className={styles.subline}>{appName}</span>
</Link>
);

View File

@@ -3,6 +3,7 @@ import config from "./config";
import { format } from "@/lib/format";
import { Flag, Item, Quadrant, Ring } from "@/lib/types";
import { assetUrl } from "@/lib/utils";
export function getLabel(key: keyof typeof config.labels) {
return config.labels[key] || "";
@@ -20,6 +21,10 @@ export function getAppName() {
return getLabel("title");
}
export function getLogoUrl() {
return assetUrl("/" + config.logoFile);
}
export function getChartConfig() {
return config.chart;
}