Skip to content

Commit

Permalink
Merge pull request #71 from Georiviere/Improve-logo-customization
Browse files Browse the repository at this point in the history
Improve logo customization
  • Loading branch information
Bo-Duke authored Apr 29, 2024
2 parents a942769 + dcff819 commit eb833b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ type LocaleSettingsFooter = {
export type RawLocalSettings = {
header?: {
logo: ImageProps;
displayTitle: boolean;
};
footer?: LocaleSettingsFooter;
homepage?: {
Expand All @@ -112,6 +113,7 @@ export type RawLocalSettings = {
export type LocalSettings = {
header?: {
logo: ImageProps;
displayTitle: boolean;
};
footer?: LocaleSettingsFooter;
homepage: {
Expand Down
15 changes: 10 additions & 5 deletions src/components/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Menu } from '@/api/settings';
import { useSettingsContext } from '@/context/settings';
import { useTranslations } from 'next-intl';

import { cn } from '@/lib/utils';
import { MainNav } from '@/components/main-nav';
import { ThemeToggle } from '@/components/theme-toggle';

Expand All @@ -20,23 +21,27 @@ export function SiteHeader({ menu }: Props) {
const { settings = null } = useSettingsContext();
return (
<header
className="sticky top-0 z-[500] w-full border-b bg-background"
className="custo-header sticky top-0 z-[500] w-full border-b bg-background"
role="banner"
>
<div className="flex h-16 items-center space-x-4 px-3 sm:justify-between sm:space-x-0">
<div className="custo-logo flex h-16 items-center space-x-4 px-3 sm:justify-between sm:space-x-0">
<Link href="/" className="flex items-center space-x-2">
{settings && settings.customization.header?.logo?.src ? (
<Image
className="lock hidden size-8 sm:inline"
width={32}
height={32}
width={300}
height={300}
{...settings.customization.header.logo}
alt={settings.customization.header.logo.alt ?? ''}
/>
) : (
<Icons.logo
{...propsForSVGPresentation}
className="lock hidden size-8 sm:inline"
className={cn(
settings?.customization.header?.displayTitle
? 'sr-only'
: 'lock hidden size-8 sm:inline',
)}
/>
)}
<span className="font-bold">{t('title')}</span>
Expand Down
3 changes: 2 additions & 1 deletion src/customization/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"header": {
"logo": {
"src": "/medias/logo.svg"
}
},
"displayTitle": true
},
"footer": {
"partners": [
Expand Down

0 comments on commit eb833b8

Please sign in to comment.