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, icon,
type = 'default', type = 'default',
children, children,
bold = false,
...props ...props
}, },
ref ref
) => { ) => {
const { iconSize } = getSize(size); const { iconSize } = getSize(size);
console.log('type', type);
return ( return (
<StyledButton <StyledButton
@@ -42,6 +42,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
hoverStyle={hoverStyle} hoverStyle={hoverStyle}
// @ts-ignore // @ts-ignore
type={type} type={type}
bold={bold}
{...props} {...props}
> >
{icon && {icon &&
+1
View File
@@ -19,4 +19,5 @@ export type ButtonProps = PropsWithChildren &
icon?: ReactElement; icon?: ReactElement;
shape?: 'default' | 'round' | 'circle'; shape?: 'default' | 'round' | 'circle';
type?: 'primary' | 'warning' | 'danger' | 'default'; type?: 'primary' | 'warning' | 'danger' | 'default';
bold?: boolean;
}; };
+3
View File
@@ -65,6 +65,7 @@ export const StyledButton = styled.button<
| 'hoverStyle' | 'hoverStyle'
| 'shape' | 'shape'
| 'type' | 'type'
| 'bold'
> >
>( >(
({ ({
@@ -74,6 +75,7 @@ export const StyledButton = styled.button<
hoverBackground, hoverBackground,
hoverColor, hoverColor,
hoverStyle, hoverStyle,
bold = false,
shape = 'default', shape = 'default',
type = 'default', type = 'default',
}) => { }) => {
@@ -91,6 +93,7 @@ export const StyledButton = styled.button<
// TODO: Implement circle shape // TODO: Implement circle shape
borderRadius: shape === 'default' ? borderRadius : height / 2, borderRadius: shape === 'default' ? borderRadius : height / 2,
fontSize, fontSize,
fontWeight: bold ? '500' : '400',
'.affine-button-icon': { '.affine-button-icon': {
color: theme.colors.iconColor, color: theme.colors.iconColor,
}, },
+2
View File
@@ -41,6 +41,7 @@ export const Confirm = ({
<StyledButtonWrapper> <StyledButtonWrapper>
<Button <Button
shape="round" shape="round"
bold={true}
onClick={() => { onClick={() => {
setOpen(false); setOpen(false);
onCancel?.(); onCancel?.();
@@ -52,6 +53,7 @@ export const Confirm = ({
<Button <Button
type={confirmType} type={confirmType}
shape="round" shape="round"
bold={true}
onClick={() => { onClick={() => {
setOpen(false); setOpen(false);
onConfirm?.(); onConfirm?.();
-1
View File
@@ -4,7 +4,6 @@ import { StyledTableCell } from './styles';
export const TableCell = ({ export const TableCell = ({
children, children,
ellipsis,
...props ...props
}: PropsWithChildren< }: PropsWithChildren<
TableCellProps & HTMLAttributes<HTMLTableCellElement> TableCellProps & HTMLAttributes<HTMLTableCellElement>