Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
36 changes: 17 additions & 19 deletions src/common/components/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,22 @@ function ToastPrefix({ variety }: Pick<ToastProps, 'variety'>) {
ToastPrefix.displayName = 'ToastPrefix';

export function ToastGlobalStyles() {
return (
<Global
styles={css`
[data-sonner-toaster] {
z-index: 0;
}

[data-sonner-toast] {
border-radius: ${cssVar('border-radius-400')};

&:focus-visible {
outline: ${cssVar('color-focus-default')} solid ${cssVar('focus-border-width-default')};
outline-offset: ${cssVar('focus-border-offset-default')};
box-shadow: none;
}
}
`}
/>
);
return <Global styles={toastGlobalStyles} />;
}
ToastGlobalStyles.displayName = 'ToastGlobalStyles';

const toastGlobalStyles = css`
[data-sonner-toaster] {
z-index: 0;
}

[data-sonner-toast] {
border-radius: ${cssVar('border-radius-400')};

&:focus-visible {
outline: ${cssVar('color-focus-default')} solid ${cssVar('focus-border-width-default')};
outline-offset: ${cssVar('focus-border-offset-default')};
box-shadow: none;
}
}
`;
9 changes: 4 additions & 5 deletions src/components/links/LinkBaseStyled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,26 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { LinkBase } from './LinkBase';
import { LinkHighlight } from './LinkTypes';

import { cssVar } from '~utils/design-tokens';

const LinkBaseStyledHighlight = {
[LinkHighlight.Accent]: css`
[LinkHighlight.Accent]: `
--color: ${cssVar('color-text-accent')};
--hover: ${cssVar('color-text-link-hover')};
`,
[LinkHighlight.Default]: css`
[LinkHighlight.Default]: `
--color: ${cssVar('color-text-default')};
--hover: ${cssVar('color-text-link-hover')};
`,
[LinkHighlight.Subtle]: css`
[LinkHighlight.Subtle]: `
--color: ${cssVar('color-text-subtle')};
--hover: ${cssVar('color-text-link-hover')};
`,
[LinkHighlight.CurrentColor]: css`
[LinkHighlight.CurrentColor]: `
--color: 'currentColor';
--hover: ${cssVar('color-text-link-hover')};
`,
Expand Down
14 changes: 6 additions & 8 deletions src/components/links/LinkStandalone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

import { css } from '@emotion/react';
import styled from '@emotion/styled';
import { forwardRef } from 'react';
import { LinkBaseStyled } from './LinkBaseStyled';
import { LinkStandaloneProps } from './LinkTypes';

import { cssVar } from '~utils/design-tokens';
import { IconCustomWrapper, IconMaterialWrapper } from '../icons/IconWrapper';

const LinkStandaloneBase = forwardRef<HTMLAnchorElement, LinkStandaloneProps>((props, ref) => {
const { children, iconLeft, isDiscreet, ...linkProps } = props;
Expand All @@ -41,11 +41,7 @@ const LinkStandaloneBase = forwardRef<HTMLAnchorElement, LinkStandaloneProps>((p
LinkStandaloneBase.displayName = 'LinkStandaloneBase';

export const LinkStandalone = styled(LinkStandaloneBase)`
${({ isDiscreet }) =>
isDiscreet &&
css`
font-weight: ${cssVar('font-weight-regular')};
`}
${({ isDiscreet }) => isDiscreet && `font-weight: ${cssVar('font-weight-regular')};`}

text-decoration-line: ${cssVar('text-decoration-none')};

Expand All @@ -62,9 +58,11 @@ export const LinkStandalone = styled(LinkStandaloneBase)`

${({ iconLeft }) =>
iconLeft &&
css`
`
& > svg,
& > img {
& > img,
& > ${IconMaterialWrapper},
& > ${IconCustomWrapper} {
margin-right: ${cssVar('dimension-space-50')};
}
`};
Expand Down
100 changes: 49 additions & 51 deletions src/components/select/SelectCommons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,71 +385,69 @@ export const SelectStyled = styled(MantineSelect)`
* Instead, these styles are added as Global emotion styles in the EchoesProvider.
*/
export function SelectGlobalStyles() {
return (
<Global
styles={css`
// Dropdown element - wrapper around the select items
.echoes-select-dropdown,
.echoes-select-dropdown-auto-width {
position: absolute;
return <Global styles={selectGlobalStyles} />;
}

overflow: hidden;
const selectGlobalStyles = css`
// Dropdown element - wrapper around the select items
.echoes-select-dropdown,
.echoes-select-dropdown-auto-width {
position: absolute;

background-color: ${cssVar('color-surface-default')};
border: ${cssVar('border-width-default')} solid ${cssVar('color-border-weak')};
border-radius: ${cssVar('border-radius-400')};
overflow: hidden;

box-shadow: ${cssVar('box-shadow-medium')};
background-color: ${cssVar('color-surface-default')};
border: ${cssVar('border-width-default')} solid ${cssVar('color-border-weak')};
border-radius: ${cssVar('border-radius-400')};

& .echoes-select-options-wrapper {
max-height: 250px;
overflow-y: auto;
box-shadow: ${cssVar('box-shadow-medium')};

padding: ${cssVar('dimension-space-100')} ${cssVar('dimension-space-0')};
}
}
& .echoes-select-options-wrapper {
max-height: 250px;
overflow-y: auto;

.echoes-select-dropdown-auto-width {
width: auto !important; // We need to override the element width set by Mantine
}
padding: ${cssVar('dimension-space-100')} ${cssVar('dimension-space-0')};
}
}

// Inside the dropdown - Group wrapper, contains a group label and all the items of a group
.echoes-select-group {
display: flex;
flex-direction: column;
padding: ${cssVar('dimension-space-0')};
}
.echoes-select-dropdown-auto-width {
width: auto !important; // We need to override the element width set by Mantine
}

// Inside the dropdown - Group wrapper, contains a group label and all the items of a group
.echoes-select-group {
display: flex;
flex-direction: column;
padding: ${cssVar('dimension-space-0')};
}

// Inside the dropdown - Group header label
.echoes-select-group-label {
padding: ${cssVar('dimension-space-50')} ${cssVar('dimension-space-200')}
${cssVar('dimension-space-100')};
// Inside the dropdown - Group header label
.echoes-select-group-label {
padding: ${`${cssVar('dimension-space-50')} ${cssVar('dimension-space-200')}
${cssVar('dimension-space-100')}`};

font: ${cssVar('typography-text-small-semi-bold')};
color: ${cssVar('color-text-default')};
}
font: ${cssVar('typography-text-small-semi-bold')};
color: ${cssVar('color-text-default')};
}

// Inside the dropdown - Adds a divider between two groups
.echoes-select-group + .echoes-select-group::before {
content: '';
// Inside the dropdown - Adds a divider between two groups
.echoes-select-group + .echoes-select-group::before {
content: '';

flex: 1;
padding: ${cssVar('dimension-space-25')} ${cssVar('dimension-space-0')};
flex: 1;
padding: ${cssVar('dimension-space-25')} ${cssVar('dimension-space-0')};

border-top: ${cssVar('border-width-default')} solid ${cssVar('color-border-weak')};
}
border-top: ${cssVar('border-width-default')} solid ${cssVar('color-border-weak')};
}

.echoes-select-empty {
font: ${cssVar('typography-text-small-medium')};
color: ${cssVar('color-text-subtle')};
text-align: center;
.echoes-select-empty {
font: ${cssVar('typography-text-small-medium')};
color: ${cssVar('color-text-subtle')};
text-align: center;

padding: ${cssVar('dimension-space-50')} ${cssVar('dimension-space-0')};
}
`}
/>
);
}
padding: ${cssVar('dimension-space-50')} ${cssVar('dimension-space-0')};
}
`;

interface SelectRightSectionProps extends Pick<SelectBaseProps, 'isLoading'> {
hasValue: boolean;
Expand Down
34 changes: 16 additions & 18 deletions src/components/typography/TypographyGlobalStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@ import { css, Global } from '@emotion/react';
import { cssVar } from '~utils/design-tokens';

export function TypographyGlobalStyles() {
return (
<Global
styles={css`
body {
font: ${cssVar('typography-text-default-regular')};
color: ${cssVar('color-text-default')};
}

pre,
code,
kbd,
samp,
tt {
font: ${cssVar('typography-code-default')};
}
`}
/>
);
return <Global styles={typographyGlobalStyles} />;
}
TypographyGlobalStyles.displayName = 'TypographyGlobalStyles';

const typographyGlobalStyles = css`
body {
font: ${cssVar('typography-text-default-regular')};
color: ${cssVar('color-text-default')};
}

pre,
code,
kbd,
samp,
tt {
font: ${cssVar('typography-code-default')};
}
`;
6 changes: 1 addition & 5 deletions stories/link/LinkStandalone-stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ export const LinkStandaloneWithIcon: Story = {
...defaultArgs,
children: 'Standalone Link With Icon',
highlight: LinkHighlight.Default,
iconLeft: (
<span style={{ marginRight: '8px' }}>
<IconLink />
</span>
),
iconLeft: <IconLink />,
},
};

Expand Down