diff --git a/modules/react/icon/stories/Image.stories.mdx b/modules/react/icon/stories/Image.stories.mdx index 204c2e6078..dc0feb4650 100644 --- a/modules/react/icon/stories/Image.stories.mdx +++ b/modules/react/icon/stories/Image.stories.mdx @@ -1,6 +1,7 @@ import {SymbolDoc} from '@workday/canvas-kit-docs'; import {Basic} from './examples/Image/Basic'; +import {FromFileSystem} from './examples/Image/FromFileSystem'; @@ -16,12 +17,16 @@ yarn add @workday/canvas-kit-react ## Usage -## Image +## Basic The `Image` component is useful when trying to render raster files or images that need additional styling like aspect ratio or object fit. It renders an `img` element and therefore you have access to all [attributes and props](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) of a native `img` tag. +## From File System + + + ## Accessibility ### Alt Text (alt): diff --git a/modules/react/icon/stories/examples/Image/FromFileSystem.tsx b/modules/react/icon/stories/examples/Image/FromFileSystem.tsx new file mode 100644 index 0000000000..e6c294012c --- /dev/null +++ b/modules/react/icon/stories/examples/Image/FromFileSystem.tsx @@ -0,0 +1,21 @@ +import React from 'react'; +import {Flex} from '@workday/canvas-kit-react/layout'; +import {Image} from '@workday/canvas-kit-react/icon'; +import {createStyles} from '@workday/canvas-kit-styling'; + +// @ts-ignore: Cannot find module error +import catImage from '../images/cat.jpg'; + +const styleOverrides = { + parentContainer: createStyles({ + maxHeight: 300, + }), +}; + +export const FromFileSystem = () => { + return ( + + Image of a cat mid yawn + + ); +}; diff --git a/modules/react/icon/stories/examples/images/cat.jpg b/modules/react/icon/stories/examples/images/cat.jpg new file mode 100644 index 0000000000..b1b433e8ee Binary files /dev/null and b/modules/react/icon/stories/examples/images/cat.jpg differ diff --git a/modules/react/icon/stories/stories.tsx b/modules/react/icon/stories/stories.tsx index 3bcc9d12a1..966d2239c3 100644 --- a/modules/react/icon/stories/stories.tsx +++ b/modules/react/icon/stories/stories.tsx @@ -116,5 +116,11 @@ storiesOf('Images and Icons/Icon', module)
+
+ +
));