Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Snackbar as shown in Figma Fixes #5666 #5700

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.medium};
font-weight: ${({ theme }) => theme.font.weight.semiBold};
gap: ${({ theme }) => theme.spacing(2)};
height: ${({ theme }) => theme.spacing(6)};
margin-bottom: ${({ theme }) => theme.spacing(1)};
Expand Down Expand Up @@ -187,9 +187,16 @@ export const SnackBar = ({
{icon}
{title}
<StyledActions>
{!!onCancel && <LightButton title="Cancel" onClick={onCancel} />}
{!!onCancel && (
<LightButton title="Cancel" onClick={onCancel}>
Cancel
</LightButton>
)}

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

Expand Down Expand Up @@ -82,6 +83,7 @@ export const LightButton = ({
accent = 'secondary',
disabled = false,
focus = false,
children,
onClick,
}: LightButtonProps) => {
const theme = useTheme();
Expand All @@ -95,7 +97,8 @@ export const LightButton = ({
className={className}
active={active}
>
{!!Icon && <Icon size={theme.icon.size.sm} />}
{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 } from 'react';
import { ComponentProps, MouseEvent, ReactNode } from 'react';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { IconComponent } from 'twenty-ui';
Expand All @@ -16,6 +16,7 @@ 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 @@ -56,13 +57,12 @@ const StyledButton = styled.button<
gap: ${({ theme }) => theme.spacing(1)};
height: ${({ size }) => (size === 'small' ? '24px' : '32px')};
justify-content: center;
padding: 0;
padding-left: 5px;
padding-right: 4px;
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,6 +91,7 @@ export const LightIconButton = ({
focus = false,
onClick,
title,
children,
}: LightIconButtonProps) => {
const theme = useTheme();
return (
Expand All @@ -106,6 +107,7 @@ export const LightIconButton = ({
active={active}
title={title}
>
{children}
{Icon && <Icon size={theme.icon.size.sm} stroke={theme.icon.stroke.sm} />}
</StyledButton>
);
Expand Down
Loading