Files
star-erp/resources/js/Components/ApplicationLogo.tsx

28 lines
681 B
TypeScript
Raw Permalink Normal View History

2026-01-07 14:44:01 +08:00
import { ImgHTMLAttributes } from 'react';
import { usePage } from '@inertiajs/react';
import { PageProps } from '@/types/global';
2026-01-07 14:44:01 +08:00
export default function ApplicationLogo(props: ImgHTMLAttributes<HTMLImageElement>) {
const { branding } = usePage<PageProps>().props;
// 如果有自訂 Logo優先使用
if (branding?.logo_url) {
return (
<img
{...props}
src={branding.logo_url}
alt="Logo"
/>
);
}
// 預設 Logo
2026-01-07 14:44:01 +08:00
return (
<img
{...props}
src="/logo.png"
alt={`${branding?.short_name || 'Star'} Logo`}
2026-01-07 14:44:01 +08:00
/>
);
}