mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	use abbr as icon fallback
This commit is contained in:
		
							parent
							
								
									16c419f816
								
							
						
					
					
						commit
						93dda99aaa
					
				@ -19,7 +19,7 @@ export default function Item({ bookmark }) {
 | 
				
			|||||||
          <div className="flex-shrink-0 flex items-center justify-center w-11 bg-theme-500/10 dark:bg-theme-900/50 text-theme-700 hover:text-theme-700 dark:text-theme-200 text-sm font-medium rounded-l-md">
 | 
					          <div className="flex-shrink-0 flex items-center justify-center w-11 bg-theme-500/10 dark:bg-theme-900/50 text-theme-700 hover:text-theme-700 dark:text-theme-200 text-sm font-medium rounded-l-md">
 | 
				
			||||||
            {bookmark.icon && 
 | 
					            {bookmark.icon && 
 | 
				
			||||||
              <div className="flex-shrink-0 w-5 h-5">
 | 
					              <div className="flex-shrink-0 w-5 h-5">
 | 
				
			||||||
                <ResolvedIcon icon={bookmark.icon} />
 | 
					                <ResolvedIcon icon={bookmark.icon} alt={bookmark.abbr} />
 | 
				
			||||||
              </div>
 | 
					              </div>
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            {!bookmark.icon && bookmark.abbr}
 | 
					            {!bookmark.icon && bookmark.abbr}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,9 +1,9 @@
 | 
				
			|||||||
import Image from "next/future/image";
 | 
					import Image from "next/future/image";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
 | 
					export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "logo" }) {
 | 
				
			||||||
  // 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={width} height={height} alt="logo" />;
 | 
					    return <Image src={`${icon}`} width={width} height={height} alt={alt} />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // mdi- prefixed, material design icons
 | 
					  // mdi- prefixed, material design icons
 | 
				
			||||||
@ -31,7 +31,7 @@ export default function ResolvedIcon({ icon, width = 32, height = 32 }) {
 | 
				
			|||||||
      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={width}
 | 
					      width={width}
 | 
				
			||||||
      height={height}
 | 
					      height={height}
 | 
				
			||||||
      alt="logo"
 | 
					      alt={alt}
 | 
				
			||||||
    />
 | 
					    />
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user