mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Use ResolvedIcon, remove extra div
This commit is contained in:
parent
645cf211dd
commit
95dcb8802a
@ -1,9 +1,9 @@
|
||||
import Image from "next/future/image";
|
||||
|
||||
export default function ResolvedIcon({ icon }) {
|
||||
export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
|
||||
// direct or relative URLs
|
||||
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
|
||||
@ -12,8 +12,8 @@ export default function ResolvedIcon({ icon }) {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
width: 32,
|
||||
height: 32,
|
||||
width,
|
||||
height,
|
||||
maxWidth: '100%',
|
||||
maxHeight: '100%',
|
||||
background: "linear-gradient(180deg, rgb(var(--color-logo-start)), rgb(var(--color-logo-stop)))",
|
||||
@ -29,8 +29,8 @@ export default function ResolvedIcon({ icon }) {
|
||||
return (
|
||||
<Image
|
||||
src={`https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/${iconName}.png`}
|
||||
width={32}
|
||||
height={32}
|
||||
width={width}
|
||||
height={height}
|
||||
alt="logo"
|
||||
/>
|
||||
);
|
||||
|
@ -1,13 +1,11 @@
|
||||
import Image from "next/future/image";
|
||||
import ResolvedIcon from "components/resolvedicon"
|
||||
|
||||
export default function Logo({ options }) {
|
||||
return (
|
||||
<div className="w-12 h-12 flex flex-row items-center align-middle mr-3 self-center">
|
||||
{options.source ?
|
||||
<Image src={`${options.source}`} width={48} height={48} alt="logo" /> :
|
||||
|
||||
// if source parameter is not set, use fallback homepage logo
|
||||
<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
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 1024 1024"
|
||||
@ -58,7 +56,6 @@ export default function Logo({ options }) {
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user