Skip to content

Commit

Permalink
Remove children
Browse files Browse the repository at this point in the history
  • Loading branch information
thomtrp committed Jun 3, 2024
1 parent 8e46d58 commit 2939480
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const StyledHeader = styled.div`
align-items: center;
color: ${({ theme }) => theme.font.color.primary};
display: flex;
font-weight: ${({ theme }) => theme.font.weight.semiBold};
font-weight: ${({ theme }) => theme.font.weight.medium};
gap: ${({ theme }) => theme.spacing(2)};
height: ${({ theme }) => theme.spacing(6)};
margin-bottom: ${({ theme }) => theme.spacing(1)};
Expand Down Expand Up @@ -187,16 +187,10 @@ export const SnackBar = ({
{icon}
{title}
<StyledActions>
{!!onCancel && (
<LightButton title="Cancel" onClick={onCancel}>
Cancel
</LightButton>
)}
{!!onCancel && <LightButton title="Cancel" onClick={onCancel} />}

{!!onClose && (
<LightIconButton title="Close" Icon={IconX} onClick={onClose}>
Cancel
</LightIconButton>
<LightIconButton title="Close" Icon={IconX} onClick={onClose} />
)}
</StyledActions>
</StyledHeader>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEvent, ReactNode } from 'react';
import { MouseEvent } from 'react';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconComponent } from 'twenty-ui';
Expand All @@ -13,7 +13,6 @@ export type LightButtonProps = {
active?: boolean;
disabled?: boolean;
focus?: boolean;
children?: ReactNode;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
};

Expand Down Expand Up @@ -83,7 +82,6 @@ export const LightButton = ({
accent = 'secondary',
disabled = false,
focus = false,
children,
onClick,
}: LightButtonProps) => {
const theme = useTheme();
Expand All @@ -97,7 +95,6 @@ export const LightButton = ({
className={className}
active={active}
>
{children}
{!!Icon && <Icon size={theme.icon.size.md} />}
{title}
</StyledButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ComponentProps, MouseEvent, ReactNode } from 'react';
import { ComponentProps, MouseEvent } from 'react';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconComponent } from 'twenty-ui';
Expand All @@ -16,7 +16,6 @@ export type LightIconButtonProps = {
active?: boolean;
disabled?: boolean;
focus?: boolean;
children?: ReactNode;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
} & Pick<ComponentProps<'button'>, 'aria-label' | 'title'>;

Expand Down Expand Up @@ -57,12 +56,13 @@ const StyledButton = styled.button<
gap: ${({ theme }) => theme.spacing(1)};
height: ${({ size }) => (size === 'small' ? '24px' : '32px')};
justify-content: center;
padding-left: 5px;
padding-right: 4px;
padding: 0;
transition: background 0.1s ease;
white-space: nowrap;
width: ${({ size }) => (size === 'small' ? '24px' : '32px')};
min-width: ${({ size }) => (size === 'small' ? '24px' : '32px')};
width: auto;
min-width: ${({ size }) => (size === 'small' ? '48px' : '64px')};
&:hover {
background: ${({ theme, disabled }) =>
Expand Down Expand Up @@ -91,7 +91,6 @@ export const LightIconButton = ({
focus = false,
onClick,
title,
children,
}: LightIconButtonProps) => {
const theme = useTheme();
return (
Expand All @@ -107,7 +106,6 @@ export const LightIconButton = ({
active={active}
title={title}
>
{children}
{Icon && <Icon size={theme.icon.size.sm} stroke={theme.icon.stroke.sm} />}
</StyledButton>
);
Expand Down

0 comments on commit 2939480

Please sign in to comment.