Skip to content

Commit

Permalink
feat: addiiton Image Component in Storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzhastin-Nikita authored and the-homeless-god committed Mar 28, 2022
1 parent 7c58d04 commit 9a888e8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/components/atoms/Image/Image.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react'

import { ComponentStory, ComponentMeta } from '@storybook/react'

import { Image, ImageProps } from './Image'

export default {
title: 'atoms/Image',
component: Image
} as ComponentMeta<React.ComponentType<ImageProps>>

const Template: ComponentStory<React.ComponentType<ImageProps>> = args => <Image {...args} />

export const Primary = Template.bind({})
Primary.args = {}
14 changes: 14 additions & 0 deletions src/components/atoms/Image/Image.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'

export type ImageProps = {
src?: string
width?: string | number
height?: string | number
className?: string
alt?: string
onClick?: () => void
}

export const Image = ({ src, className, alt, height, width, onClick }: ImageProps) => {
return <img className={className} onClick={onClick} alt={alt} src={src} width={width} height={height} />
}
1 change: 1 addition & 0 deletions src/components/atoms/Image/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Image'
3 changes: 2 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LoginButton } from './atoms/LoginButton'
import { Image } from './atoms/Image'

export default { LoginButton }
export default { LoginButton, Image }

0 comments on commit 9a888e8

Please sign in to comment.