Skip to content

Commit df0af2c

Browse files
committed
feat: add button size "s" & "m" variations
1 parent 7de868a commit df0af2c

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

packages/components/button/src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { getDisplayName } from "@react-ck/react-utils";
99
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
1010
/** Defines the color scheme of the button */
1111
skin?: "primary" | "secondary" | "ghost";
12+
/** Defines the scale of the button */
13+
size?: "s" | "m";
1214
/**
1315
* Content slot to receive an icon.
1416
* This can be any valid React node, allowing integration of icons or custom SVG components.
@@ -26,6 +28,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
2628

2729
export const Button = ({
2830
skin = "primary",
31+
size = "m",
2932
icon,
3033
children,
3134
className,
@@ -51,6 +54,7 @@ export const Button = ({
5154
className={classNames(
5255
styles.root,
5356
styles[skin],
57+
styles[`size-${size}`],
5458
{
5559
[`${styles["icon-only"]}`]: isIconOnly,
5660
},

packages/components/button/src/styles/index.module.scss

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
@include text-base;
66

77
@include define-css-var(button, border-radius, get-spacing(1));
8-
@include define-css-var(button, padding-y, get-spacing(1));
9-
@include define-css-var(button, padding-x, get-spacing(2));
108

119
background-color: get-css-var(button, background-color);
1210
color: get-css-var(button, color);
@@ -25,13 +23,33 @@
2523
}
2624

2725
&.icon-only {
28-
@include define-css-var(button, padding-x, get-spacing(1));
2926
@include define-css-var(button, border-radius, 50%);
30-
3127
aspect-ratio: 1/1;
3228
}
3329
}
3430

31+
.size-m {
32+
@include define-css-var(button, padding-y, get-spacing(1));
33+
@include define-css-var(button, padding-x, get-spacing(2));
34+
35+
&.icon-only {
36+
@include define-css-var(button, padding-x, get-spacing(1));
37+
@include define-css-var(button, padding-t, get-spacing(1));
38+
}
39+
}
40+
41+
.size-s {
42+
@include define-css-var(button, padding-y, get-spacing(0.25));
43+
@include define-css-var(button, padding-x, get-spacing(1.25));
44+
45+
&.icon-only {
46+
@include define-css-var(button, padding-x, get-spacing(0.66));
47+
@include define-css-var(button, padding-t, get-spacing(0.66));
48+
49+
@include text-variation(smallest);
50+
}
51+
}
52+
3553
.primary {
3654
@include define-css-var(button, background-color, get-color(highlight-primary));
3755
@include define-css-var(button, color, get-color(neutral-light-1));

0 commit comments

Comments
 (0)