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

ボタンサイズを変更できるようにした #55

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
39 changes: 33 additions & 6 deletions src/components/LinkButton/LinkButton.module.css
yukikamome316 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,31 +1,58 @@
.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;
}

.greenButton.small {
padding: 1em 2em;
}

.greenButton.large {
padding: 1em 2em;
}

shigekk marked this conversation as resolved.
Show resolved Hide resolved
.greenButton:hover {
background-color: #36773c;
}

.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 3em;
}

.grayButton.large {
padding: 0.5em 3em;
}
shigekk marked this conversation as resolved.
Show resolved Hide resolved

.grayButton:hover {
background-color: #000000;
}
10 changes: 6 additions & 4 deletions src/components/LinkButton/LinkButton.stories.tsx
shigekk marked this conversation as resolved.
Show resolved Hide resolved
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