-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from MARU-EGG/Header-component
[USER] Feat icon-button atom component
- Loading branch information
Showing
9 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,56 @@ | ||
import React from 'react'; | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import IconButton from './icon-button'; | ||
import { ReactComponent as MenuIcon } from '../../../../../public/Menu.svg'; | ||
import { ReactComponent as SendIcon } from '../../../../../public/Send.svg'; | ||
import { ReactComponent as XIcon } from '../../../../../public/X.svg'; | ||
import { ReactComponent as RefreshIcon } from '../../../../../public/Refresh.svg'; | ||
|
||
const meta = { | ||
title: 'Example/IconButton', | ||
component: IconButton, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
args: { | ||
onClick: () => console.log('Button clicked'), | ||
}, | ||
} satisfies Meta<typeof IconButton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
children: <MenuIcon />, // Menu.svg 사용 | ||
}, | ||
}; | ||
|
||
export const Disabled: Story = { | ||
args: { | ||
children: <MenuIcon />, // Menu.svg 사용 | ||
disabled: true, | ||
}, | ||
}; | ||
|
||
// XIcon 사용 스토리 | ||
export const WithXIcon: Story = { | ||
args: { | ||
children: <XIcon />, // X.svg 사용 | ||
}, | ||
}; | ||
|
||
// SendIcon 사용 스토리 | ||
export const WithSendIcon: Story = { | ||
args: { | ||
children: <SendIcon />, // Send.svg 사용 | ||
}, | ||
}; | ||
|
||
// RefreshIcon 사용 스토리 | ||
export const WithRefreshIcon: Story = { | ||
args: { | ||
children: <RefreshIcon />, // Refresh.svg 사용 | ||
}, | ||
}; |
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,22 @@ | ||
import React from 'react'; | ||
import { cn } from '../../../../utils/style'; | ||
|
||
interface IconButtonProps { | ||
onClick: React.MouseEventHandler<HTMLButtonElement>; | ||
disabled?: boolean; | ||
children: any; | ||
} | ||
|
||
const IconButton = ({ onClick, disabled, children }: IconButtonProps) => { | ||
return ( | ||
<button | ||
className={cn('cursor-pointer', disabled ? 'text-primary-blue' : 'text-black')} | ||
onClick={onClick} | ||
disabled={disabled} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default IconButton; |
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