feat: modify button component

This commit is contained in:
QiShaoXuan
2022-12-09 19:00:42 +08:00
parent 57f19ee4a7
commit 4699f8f3bf
5 changed files with 8 additions and 2 deletions
+2 -1
View File
@@ -24,12 +24,12 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
icon,
type = 'default',
children,
bold = false,
...props
},
ref
) => {
const { iconSize } = getSize(size);
console.log('type', type);
return (
<StyledButton
@@ -42,6 +42,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
hoverStyle={hoverStyle}
// @ts-ignore
type={type}
bold={bold}
{...props}
>
{icon &&
+1
View File
@@ -19,4 +19,5 @@ export type ButtonProps = PropsWithChildren &
icon?: ReactElement;
shape?: 'default' | 'round' | 'circle';
type?: 'primary' | 'warning' | 'danger' | 'default';
bold?: boolean;
};
+3
View File
@@ -65,6 +65,7 @@ export const StyledButton = styled.button<
| 'hoverStyle'
| 'shape'
| 'type'
| 'bold'
>
>(
({
@@ -74,6 +75,7 @@ export const StyledButton = styled.button<
hoverBackground,
hoverColor,
hoverStyle,
bold = false,
shape = 'default',
type = 'default',
}) => {
@@ -91,6 +93,7 @@ export const StyledButton = styled.button<
// TODO: Implement circle shape
borderRadius: shape === 'default' ? borderRadius : height / 2,
fontSize,
fontWeight: bold ? '500' : '400',
'.affine-button-icon': {
color: theme.colors.iconColor,
},
+2
View File
@@ -41,6 +41,7 @@ export const Confirm = ({
<StyledButtonWrapper>
<Button
shape="round"
bold={true}
onClick={() => {
setOpen(false);
onCancel?.();
@@ -52,6 +53,7 @@ export const Confirm = ({
<Button
type={confirmType}
shape="round"
bold={true}
onClick={() => {
setOpen(false);
onConfirm?.();
-1
View File
@@ -4,7 +4,6 @@ import { StyledTableCell } from './styles';
export const TableCell = ({
children,
ellipsis,
...props
}: PropsWithChildren<
TableCellProps & HTMLAttributes<HTMLTableCellElement>