Skip to content

Commit

Permalink
Merge pull request #55 from saitamau-maximum/feat/button-implementation
Browse files Browse the repository at this point in the history
ボタンサイズを変更できるようにした
  • Loading branch information
a01sa01to authored Mar 27, 2024
2 parents 00dc6e4 + beabd32 commit f8ce562
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
27 changes: 21 additions & 6 deletions src/components/LinkButton/LinkButton.module.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
.button {
display: inline-block;
font-size: 1.5rem;
text-align: center;
text-decoration: none;
}

.small {
font-size: 1rem;
}

.medium {
font-size: 1.5rem;
}

.large {
font-size: 2rem;
}

.greenButton {
padding: 24px 48px;
padding: 1em 2em;
background-color: #439154;
color: #FFFFFF;
color: #ffffff;
border: none;
border-radius: 999px;
transition: background-color 0.3s ease;
Expand All @@ -19,13 +30,17 @@
}

.grayButton {
padding: 12px 64px;
padding: 0.5em 3em;
background-color: #414141;
color: #FFFFFF;
border: 1px solid #FFFFFF;
color: #ffffff;
border: 1px solid #ffffff;
transition: background-color 0.3s ease;
}

.grayButton.small {
padding: 0.5em 2em;
}

.grayButton:hover {
background-color: #000000;
}
10 changes: 6 additions & 4 deletions src/components/LinkButton/LinkButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ export default {

const Template: StoryFn<typeof LinkButton> = (args) => <LinkButton {...args} />;

export const Primary = Template.bind({});
Primary.args = {
export const Green = Template.bind({});
Green.args = {
children: 'Click Me',
variant: 'green',
href: '/',
size: 'medium',
};

export const Secondary = Template.bind({});
Secondary.args = {
export const Gray = Template.bind({});
Gray.args = {
children: 'Click Me',
variant: 'gray',
href: '/',
size: 'medium',
};
3 changes: 3 additions & 0 deletions src/components/LinkButton/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ import styles from './LinkButton.module.css';
interface ButtonProps extends Omit<LinkProps, 'href'> {
href: string;
variant: 'green' | 'gray';
size?: 'small' | 'medium' | 'large';
children: React.ReactNode;
}

export const LinkButton: React.FC<ButtonProps> = ({
href,
variant,
size = 'medium',
children,
...props
}) => {
const className = clsx(
styles.button,
styles[size],
variant === 'green' && styles.greenButton,
variant === 'gray' && styles.grayButton,
);
Expand Down

0 comments on commit f8ce562

Please sign in to comment.