From b032eeb51efe28fd2f7f084f412d75c2ada79ff4 Mon Sep 17 00:00:00 2001 From: mildtomato Date: Thu, 7 Jan 2021 14:01:30 +0800 Subject: [PATCH 01/11] fix: fix `children` error in Transition in Button component --- src/components/Button/Button.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Button/Button.js b/src/components/Button/Button.js index 3957d0cc..709db0c1 100644 --- a/src/components/Button/Button.js +++ b/src/components/Button/Button.js @@ -12,7 +12,7 @@ const Button = ({ children, disabled = false, onClick, - icon = undefined, + icon, loading = false, shadow = true, size = 'medium', @@ -55,6 +55,8 @@ const Button = ({ classes.push(`sbui-btn-${type}`) + const showIcon = loading || icon + return ( @@ -68,8 +70,9 @@ const Button = ({ style={style} type="button" > + {showIcon && ( {icon} ) : null} + )} {children && {children}} From f76f11e58a1ec9b04db0787de5a5ff9fc5f83884 Mon Sep 17 00:00:00 2001 From: mildtomato Date: Thu, 7 Jan 2021 14:04:58 +0800 Subject: [PATCH 02/11] chore: remove sizeClasses as its not needed --- src/components/Button/Button.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/components/Button/Button.js b/src/components/Button/Button.js index 709db0c1..43acdb0e 100644 --- a/src/components/Button/Button.js +++ b/src/components/Button/Button.js @@ -43,14 +43,7 @@ const Button = ({ } if (size) { - let sizeClasses = { - tiny: 'sbui-btn--tiny', - small: 'sbui-btn--small', - medium: 'sbui-btn--medium', - large: 'sbui-btn--large', - xlarge: 'sbui-btn--xlarge', - } - classes.push(sizeClasses[size]) + classes.push(`sbui-btn--${size}`) } classes.push(`sbui-btn-${type}`) From 907d753cefa61f23979023eca0faf485c01ba64e Mon Sep 17 00:00:00 2001 From: mildtomato Date: Thu, 7 Jan 2021 15:07:40 +0800 Subject: [PATCH 03/11] fix: added -export const withStyles = (args) => -export const withIcon = (args) => -export const withBlock = (args) => -export const withOnlyIcon = (args) => +export const withStyles = (args: any) => +export const withIcon = (args: any) => +export const withBlock = (args: any) => +export const withOnlyIcon = (args: any) => export const withStyles = (args: any) => export const withIcon = (args: any) => +export const withIconRight = (args: any) => export const withBlock = (args: any) => export const withOnlyIcon = (args: any) => From 6142d3181e0e2c76547e50b053725ad4f444c51f Mon Sep 17 00:00:00 2001 From: mildtomato Date: Thu, 7 Jan 2021 16:14:02 +0800 Subject: [PATCH 11/11] chore: add `size` default to component --- src/components/Space/Space.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/Space/Space.tsx b/src/components/Space/Space.tsx index ea527e2a..0005afe8 100644 --- a/src/components/Space/Space.tsx +++ b/src/components/Space/Space.tsx @@ -1,8 +1,7 @@ import React from 'react' import './Space.css' -function Space (props: any) { - const { direction, size, className, block, style, minus } = props +function Space ({direction, size = 2, className, block, style, minus, children}: any) { const classes = [] classes.push(direction === 'vertical' ? 'sbui-space-col' : 'sbui-space-row') @@ -16,7 +15,7 @@ function Space (props: any) { return (
- {props.children} + {children}
) }