Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] InfoBtn 컴포넌트 구현 #76

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/common/button/infoBtn/InfoBtn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Icon from '@assets/svgs';
import buttonStyle from '@components/common/button/infoBtn/infoBtn.css';

interface InfoBtnProps {
label: string;
onClick: () => void;
hasDivider?: boolean;
}

const InfoBtn = ({ label, onClick, hasDivider = false }: InfoBtnProps) => {
return (
<button onClick={onClick} className={buttonStyle({ hasDivider })}>
<p>{label} </p>
<Icon.IcnArrowGrayRight />
</button>
);
};

export default InfoBtn;
26 changes: 26 additions & 0 deletions src/components/common/button/infoBtn/infoBtn.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import theme from '@styles/theme.css';
import { recipe } from '@vanilla-extract/recipes';

const buttonStyle = recipe({
base: {
backgroundColor: '#fff',
...theme.FONTS.h5Sb16,
display: 'flex',
justifyContent: 'space-between',
width: '31.7rem',
padding: '1.6rem 2.3rem 1.6rem 0',
},
variants: {
hasDivider: {
true: {
boxShadow: `0px 1px 0px 0px ${theme.COLORS.gray2}`,
},
false: {},
},
},
defaultVariants: {
hasDivider: false,
},
});

export default buttonStyle;
33 changes: 33 additions & 0 deletions src/stories/InfoBtn.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import InfoBtn from '@components/common/button/infoBtn/InfoBtn';
import type { Meta, StoryObj } from '@storybook/react';

const meta = {
title: 'Common/Button/InfoBtn',
component: InfoBtn,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {
label: {
control: { type: 'text' },
},
onClick: {
action: 'clicked',
},
hasDivider: {
action: 'boolean',
},
},
args: {
label: '공지사항',
onClick: () => alert('click !'),
hasDivider: true,
},
} satisfies Meta<typeof InfoBtn>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};
Loading