forked from onyx-dot-app/onyx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
"use client"; | ||
|
||
import { useContext } from "react"; | ||
import { SettingsContext } from "./settings/SettingsProvider"; | ||
import Image from "next/image"; | ||
|
||
export function Logo({ | ||
height, | ||
width, | ||
className, | ||
}: { | ||
height?: number; | ||
width?: number; | ||
className?: string; | ||
}) { | ||
const settings = useContext(SettingsContext); | ||
|
||
height = height || 32; | ||
width = width || 70; | ||
|
||
if ( | ||
!settings || | ||
!settings.enterpriseSettings || | ||
!settings.enterpriseSettings.use_custom_logo | ||
) { | ||
return ( | ||
<div style={{ height, width }} className={className}> | ||
<Image src="/EEA_logo_compact_EN.svg" alt="Logo" width={width} height={height} /> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div | ||
style={{ height, width }} | ||
className={`flex-none relative ${className}`} | ||
> | ||
{/* TODO: figure out how to use Next Image here */} | ||
<img | ||
src="/api/enterprise-settings/logo" | ||
alt="Logo" | ||
style={{ objectFit: "contain", height, width }} | ||
/> | ||
</div> | ||
); | ||
} | ||
export function Logo_empty({ | ||
height, | ||
width, | ||
className, | ||
}: { | ||
height?: number; | ||
width?: number; | ||
className?: string; | ||
}) { | ||
const settings = useContext(SettingsContext); | ||
|
||
height = height || 32; | ||
width = width || 32; | ||
if ( | ||
!settings || | ||
!settings.enterpriseSettings || | ||
!settings.enterpriseSettings.use_custom_logo | ||
) { | ||
return ( | ||
<div style={{ height, width }} className={className}> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div | ||
style={{ height, width }} | ||
className={`flex-none relative ${className}`} | ||
> | ||
{/* TODO: figure out how to use Next Image here */} | ||
<img | ||
src="/api/enterprise-settings/logo" | ||
alt="Logo" | ||
style={{ objectFit: "contain", height, width }} | ||
/> | ||
</div> | ||
); | ||
} |