-
Notifications
You must be signed in to change notification settings - Fork 387
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
1 parent
e5e7cfa
commit 91b4be7
Showing
4 changed files
with
23 additions
and
2 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,3 @@ | ||
{ | ||
"https://www.figma.com/design/GCvY3Qv8czRgZgvl1dG6lp/Primer-Web?node-id=26998-2424&t=eruKCwLaYv3FX2Vu-4": "https://user-images.githubusercontent.com/97200987/176713532-b80d0221-fc01-4bbc-bb5d-0a152bf127d2.png" | ||
} |
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
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
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,17 @@ | ||
import React from 'react'; | ||
import Images from '../../content/FigmaImageSources.json'; | ||
|
||
|
||
type FigmaImageProps = React.ImgHTMLAttributes<HTMLImageElement> & { | ||
src: string | ||
} | ||
|
||
export const FigmaImage: React.FC<FigmaImageProps> = ({src, ...props}) => { | ||
// check for missing prop | ||
if(src === undefined) throw new Error("src is required on FigmaImage component"); | ||
// get real image url | ||
const realImageSrc = Images[src] | ||
if (realImageSrc === undefined) throw new Error(`Image with src ${src} not found in FigmaImageSources.json`); | ||
// return image component | ||
return (<img src={realImageSrc} {...props}/>) | ||
} |