Skip to content
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
6 changes: 6 additions & 0 deletions apps/site/components/Common/Button/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
@apply cursor-not-allowed;
}

&.small {
@apply px-3
py-2
text-sm;
}

&.neutral {
@apply rounded
bg-neutral-900
Expand Down
15 changes: 14 additions & 1 deletion apps/site/components/Common/Button/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const Neutral: Story = {
kind: 'neutral',
children: 'Download Node (LTS)',
disabled: false,
size: 'default',
},
};

Expand All @@ -19,6 +20,7 @@ export const Primary: Story = {
kind: 'primary',
children: 'Download Node (LTS)',
disabled: false,
size: 'default',
},
};

Expand All @@ -27,6 +29,7 @@ export const Secondary: Story = {
kind: 'secondary',
children: 'Download Node (LTS)',
disabled: false,
size: 'default',
},
};

Expand All @@ -35,6 +38,7 @@ export const Special: Story = {
kind: 'special',
children: 'Download Node (LTS)',
disabled: false,
size: 'default',
},
};

Expand All @@ -48,7 +52,16 @@ export const WithIcon: Story = {
</>
),
disabled: false,
size: 'default',
},
};

export default { component: Button } as Meta;
export default {
component: Button,
argTypes: {
size: {
options: ['default', 'small'],
control: { type: 'radio' },
},
},
} as Meta;
9 changes: 8 additions & 1 deletion apps/site/components/Common/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import styles from './index.module.css';

type ButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
kind?: 'neutral' | 'primary' | 'secondary' | 'special';
size?: 'default' | 'small';
disabled?: boolean;
};

const Button: FC<ButtonProps> = ({
kind = 'primary',
size = 'default',
disabled = false,
href = undefined,
children,
Expand Down Expand Up @@ -56,7 +58,12 @@ const Button: FC<ButtonProps> = ({
role="button"
href={disabled ? undefined : href}
aria-disabled={disabled}
className={classNames(styles.button, styles[kind], className)}
className={classNames(
styles.button,
styles[kind],
styles[size],
className
)}
tabIndex={disabled ? -1 : 0} // Ensure focusable if not disabled
onClick={onClickHandler}
onKeyDown={onKeyDownHandler}
Expand Down
Loading