mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-02 13:33:40 +01:00
Merge pull request #664 from Snekussaurier/feature-565
Add ability to use custom logo
This commit is contained in:
commit
4f38c0ee80
@ -1,9 +1,9 @@
|
|||||||
import Image from "next/future/image";
|
import Image from "next/future/image";
|
||||||
|
|
||||||
export default function ResolvedIcon({ icon }) {
|
export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
|
||||||
// direct or relative URLs
|
// direct or relative URLs
|
||||||
if (icon.startsWith("http") || icon.startsWith("/")) {
|
if (icon.startsWith("http") || icon.startsWith("/")) {
|
||||||
return <Image src={`${icon}`} width={32} height={32} alt="logo" />;
|
return <Image src={`${icon}`} width={width} height={height} alt="logo" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mdi- prefixed, material design icons
|
// mdi- prefixed, material design icons
|
||||||
@ -12,8 +12,8 @@ export default function ResolvedIcon({ icon }) {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
width: 32,
|
width,
|
||||||
height: 32,
|
height,
|
||||||
maxWidth: '100%',
|
maxWidth: '100%',
|
||||||
maxHeight: '100%',
|
maxHeight: '100%',
|
||||||
background: "linear-gradient(180deg, rgb(var(--color-logo-start)), rgb(var(--color-logo-stop)))",
|
background: "linear-gradient(180deg, rgb(var(--color-logo-start)), rgb(var(--color-logo-stop)))",
|
||||||
@ -29,8 +29,8 @@ export default function ResolvedIcon({ icon }) {
|
|||||||
return (
|
return (
|
||||||
<Image
|
<Image
|
||||||
src={`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${iconName}.png`}
|
src={`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${iconName}.png`}
|
||||||
width={32}
|
width={width}
|
||||||
height={32}
|
height={height}
|
||||||
alt="logo"
|
alt="logo"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
export default function Logo() {
|
import ResolvedIcon from "components/resolvedicon"
|
||||||
|
|
||||||
|
export default function Logo({ options }) {
|
||||||
return (
|
return (
|
||||||
<div className="w-12 h-12 flex flex-row items-center align-middle mr-3 self-center">
|
<div className="w-12 h-12 flex flex-row items-center align-middle mr-3 self-center">
|
||||||
|
{options.icon ?
|
||||||
|
<ResolvedIcon icon={options.icon} width={48} height={48} /> :
|
||||||
|
// fallback to homepage logo
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
viewBox="0 0 1024 1024"
|
viewBox="0 0 1024 1024"
|
||||||
@ -51,6 +56,7 @@ export default function Logo() {
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
}
|
||||||
);
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user