mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-06 08:50:50 +08:00
feat: modify button component
This commit is contained in:
@@ -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 &&
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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?.();
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user