diff --git a/content/FigmaImageSources.json b/content/FigmaImageSources.json new file mode 100644 index 0000000000..3f5ecfd5d3 --- /dev/null +++ b/content/FigmaImageSources.json @@ -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" +} diff --git a/content/components/avatar.mdx b/content/components/avatar.mdx index 99d7c88150..b64659717a 100644 --- a/content/components/avatar.mdx +++ b/content/components/avatar.mdx @@ -13,6 +13,7 @@ import {Box, Text} from '@primer/react' import ComponentLayout from '~/src/layouts/component-layout' export default ComponentLayout import {AccessibilityLink} from '~/src/components/accessibility-link' +import {FigmaImage} from '~/src/components/FigmaImage' -Demo & { + src: string +} + +export const FigmaImage: React.FC = ({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 () +} \ No newline at end of file