mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-31 06:24:02 +00:00 
			
		
		
		
	Merge pull request #1405 from ervwalter/square-icons
force icons to fit withing a 32x32 square
This commit is contained in:
		
						commit
						cf3fc1d64b
					
				| @ -3,7 +3,19 @@ import Image from "next/future/image"; | |||||||
| export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "logo" }) { | 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={alt} />; |     return ( | ||||||
|  |       <Image | ||||||
|  |         src={`${icon}`} | ||||||
|  |         width={width} | ||||||
|  |         height={height} | ||||||
|  |         style={{ | ||||||
|  |           width, | ||||||
|  |           height, | ||||||
|  |           objectFit: "contain", | ||||||
|  |         }} | ||||||
|  |         alt={alt} | ||||||
|  |       /> | ||||||
|  |     ); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // mdi- prefixed, material design icons |   // mdi- prefixed, material design icons | ||||||
| @ -31,6 +43,11 @@ export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "log | |||||||
|       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} | ||||||
|  |       style={{ | ||||||
|  |         width, | ||||||
|  |         height, | ||||||
|  |         objectFit: "contain", | ||||||
|  |       }} | ||||||
|       alt={alt} |       alt={alt} | ||||||
|     /> |     /> | ||||||
|   ); |   ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 shamoon
						shamoon