Skip to content

Commit 9a888e8

Browse files
Uzhastin-Nikitathe-homeless-god
authored andcommitted
feat: addiiton Image Component in Storybook
1 parent 7c58d04 commit 9a888e8

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
3+
import { ComponentStory, ComponentMeta } from '@storybook/react'
4+
5+
import { Image, ImageProps } from './Image'
6+
7+
export default {
8+
title: 'atoms/Image',
9+
component: Image
10+
} as ComponentMeta<React.ComponentType<ImageProps>>
11+
12+
const Template: ComponentStory<React.ComponentType<ImageProps>> = args => <Image {...args} />
13+
14+
export const Primary = Template.bind({})
15+
Primary.args = {}

src/components/atoms/Image/Image.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
3+
export type ImageProps = {
4+
src?: string
5+
width?: string | number
6+
height?: string | number
7+
className?: string
8+
alt?: string
9+
onClick?: () => void
10+
}
11+
12+
export const Image = ({ src, className, alt, height, width, onClick }: ImageProps) => {
13+
return <img className={className} onClick={onClick} alt={alt} src={src} width={width} height={height} />
14+
}

src/components/atoms/Image/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Image'

src/components/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { LoginButton } from './atoms/LoginButton'
2+
import { Image } from './atoms/Image'
23

3-
export default { LoginButton }
4+
export default { LoginButton, Image }

0 commit comments

Comments
 (0)