Skip to content

Commit a4d3c14

Browse files
committed
refactor: simplify buttons by not supporting inner div for gradiant type button borders
1 parent 8970da9 commit a4d3c14

File tree

2 files changed

+9
-41
lines changed

2 files changed

+9
-41
lines changed

packages/@holaplexui-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@holaplex/ui-library-react",
33
"author": "Holaplex Inc.",
4-
"version": "0.17.0",
4+
"version": "0.17.1",
55
"description": "Holaplex react ui library components",
66
"private": false,
77
"files": [

packages/@holaplexui-react/src/components/Button.tsx

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Spinner } from './Spinner';
55
export interface ButtonProps {
66
variant?: 'primary' | 'secondary' | 'tertiary' | 'success' | 'failure' | 'link';
77
size?: 'small' | 'medium' | 'large';
8-
border?: 'circle' | 'rounded' | 'square';
98
loading?: boolean;
109
block?: boolean;
1110
icon?: ReactElement;
@@ -20,7 +19,6 @@ export interface ButtonProps {
2019

2120
export const Button = ({
2221
variant = 'primary',
23-
border = 'rounded',
2422
size = 'medium',
2523
loading = false,
2624
block = false,
@@ -33,19 +31,6 @@ export const Button = ({
3331
className,
3432
children,
3533
}: ButtonProps): JSX.Element => {
36-
const spinnerSize = useMemo(() => {
37-
switch (size) {
38-
case 'small':
39-
return '10px';
40-
case 'medium':
41-
return '15px';
42-
case 'large':
43-
return '20px';
44-
default:
45-
return '15px';
46-
}
47-
}, [size]);
48-
4934
const spinnerVariant = useMemo(() => {
5035
switch (variant) {
5136
case 'primary':
@@ -84,43 +69,26 @@ export const Button = ({
8469
<button
8570
className={clsx(
8671
clsx,
87-
'group flex grow-0 items-center justify-center text-center',
72+
'group flex grow-0 items-center justify-center text-center gap-2',
8873
buttonVariant,
8974
{
90-
'rounded-md': border === 'rounded',
91-
'rounded-full': border === 'circle',
92-
'rounded-none': border === 'square',
9375
'w-full': block,
94-
'py-1 px-2 text-sm': size === 'small' || size === 'medium',
95-
'py-2 px-4': size === 'large',
9676
'disabled:opacity-50': disabled,
9777
'px-0 py-0': circle,
78+
'button-small': size === 'small',
79+
'button-medium': size === 'medium',
80+
'button-large': size === 'large',
9881
},
9982
className
10083
)}
10184
disabled={disabled}
10285
type={htmlType}
10386
onClick={onClick}
10487
>
105-
<div
106-
className={clsx(
107-
'flex h-full w-full grow-0 items-center justify-center gap-2 rounded-full text-center',
108-
{
109-
'button-small': size === 'small',
110-
'button-medium': size === 'medium',
111-
'button-large': size === 'large',
112-
}
113-
)}
114-
>
115-
{loading &&
116-
(spinner ? (
117-
spinner
118-
) : (
119-
<Spinner variant={spinnerVariant} className="inline aspect-square" />
120-
))}
121-
{icon && icon}
122-
{children && <span>{children}</span>}
123-
</div>
88+
{loading &&
89+
(spinner ? spinner : <Spinner variant={spinnerVariant} className="inline aspect-square" />)}
90+
{icon && icon}
91+
{children && <span>{children}</span>}
12492
</button>
12593
);
12694
};

0 commit comments

Comments
 (0)