Skip to content

Commit

Permalink
feat(new-hope): toast and notification tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
iljs authored and Yakutoc committed Dec 4, 2024
1 parent 9138c98 commit 53630d0
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 15 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -87,6 +89,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/plasma-b2c/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ export const Wrapper = styled.li<{ variant: DropdownProps['variant'] }>`
&:hover:not(.${classes.dropdownItemIsDisabled}) {
cursor: pointer;
background-color: var(${constants.itemBackgroundHover});
background-color: var(${constants.itemBackgroundHover}, var(${constants.itemBackgroundHover}));
}
&.${classes.dropdownItemIsActive} {
background-color: var(${constants.itemBackgroundHover});
background-color: var(${constants.itemBackgroundHover}, var(${constants.itemBackgroundHover}));
}
&.${classes.dropdownItemIsDisabled} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const Button = component(mergedButtonConfig);

export const CloseIconWrapper = styled(Button)`
position: absolute;
width: 1.5rem;
height: 1.5rem;
width: var(${tokens.closeIconButtonSize});
height: var(${tokens.closeIconButtonSize});
color: var(${tokens.closeIconColor});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@ export const tokens = {
closeIconRight: '--plasma-notification-close-icon-right',
closeIconColor: '--plasma-notification-close-icon-color',
closeIconColorOnHover: '--plasma-notification-close-icon-color-on-hover',
closeIconSize: '--plasma-notification-close-icon-size',
closeIconButtonSize: '--plasma-notification-close-icon-button-size',
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RootProps } from '../../engines';
import { cx } from '../../utils';
import { IconCross } from '../_Icon/Icons/IconCross';

import { classes } from './Notification.tokens';
import { classes, tokens } from './Notification.tokens';
import { base as viewCSS } from './variations/_view/base';
import { base as layoutCSS } from './variations/_layout/base';
import { base as sizeCSS } from './variations/_size/base';
Expand Down Expand Up @@ -107,7 +107,7 @@ export const notificationRoot = (Root: RootProps<HTMLDivElement, Omit<Notificati
onClick={onCloseButtonClick}
className={cx(classes.closeIcon, getLayoutClass(layout))}
>
<IconCross size="s" color="inherit" />
<IconCross size="s" sizeCustomProperty={tokens.closeIconSize} color="inherit" />
</CloseIconWrapper>
)}
</Wrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const StyledRoot = styled.div<{ position: string; isVisible: boolean; off
`;

export const CloseIconWrapper = styled(Button)`
height: 1rem;
height: var(${tokens.closeIconButtonSize});
--plasma_private-close-icon-margin: var(${tokens.closeIconMargin});
margin: var(--plasma_private-close-icon-margin);
Expand Down
2 changes: 2 additions & 0 deletions packages/plasma-new-hope/src/components/Toast/Toast.tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ export const tokens = {
closeIconMargin: '--plasma-toast-close-icon-margin',
closeIconColor: '--plasma-toast-close-icon-color',
closeIconColorOnHover: '--plasma-toast-close-icon-color-on-hover',
closeIconSize: '--plasma-toast-close-icon-size',
closeIconButtonSize: '--plasma-toast-close-icon-button-size',
};
4 changes: 2 additions & 2 deletions packages/plasma-new-hope/src/components/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { RootProps } from '../../engines';
import { cx } from '../../utils';
import { IconCross } from '../_Icon/Icons/IconCross';

import { classes } from './Toast.tokens';
import { classes, tokens } from './Toast.tokens';
import { base as viewCSS } from './variations/_view/base';
import { base as sizeCSS } from './variations/_size/base';
import { base as pilledCSS } from './variations/_pilled/base';
Expand Down Expand Up @@ -64,7 +64,7 @@ export const toastRoot = (Root: RootProps<HTMLDivElement, ToastProps>) =>
className={cx(classes.closeIcon)}
stretching="fixed"
>
<IconCross size="s" color="inherit" />
<IconCross size="s" sizeCustomProperty={tokens.closeIconSize} color="inherit" />
</CloseIconWrapper>
)}
</Root>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -89,6 +91,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -89,6 +91,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -87,6 +89,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/plasma-web/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
1 change: 0 additions & 1 deletion packages/sdds-cs/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const config: StorybookConfig = {
base: '',
resolve: {
dedupe: ['react', 'react-dom', 'styled-components'],
preserveSymlinks: true,
},
build: {
sourcemap: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/sdds-cs/src/components/Dropdown/Dropdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export const config = {
${tokens.padding}: 0.125rem;
${tokens.width}: 12.5rem;
${tokens.borderRadius}: 0.625rem;
${dropdownTokens.padding}: 0.125rem;
${dropdownTokens.width}: 12.5rem;
${dropdownTokens.borderRadius}: 0.625rem;
${dropdownTokens.borderWidth}: 0.125rem;
${tokens.padding}: 0.125rem;
${tokens.width}: 12.5rem;
${tokens.borderRadius}: 0.625rem;
${tokens.borderWidth}: 0.125rem;
${tokens.itemHeight}: 1.5rem;
${tokens.itemPadding}: 0.5rem 0.75rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export const config = {
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.borderWidth}: 0.125rem;
${notificationTokens.closeIconButtonSize}: 2rem;
${notificationTokens.closeIconSize}: 2rem;
${notificationTokens.padding}: 0.75rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -86,6 +88,8 @@ export const config = {
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.borderWidth}: 0.125rem;
${notificationTokens.closeIconButtonSize}: 2rem;
${notificationTokens.closeIconSize}: 2rem;
${notificationTokens.padding}: 0.75rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/sdds-cs/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5rem 0.5rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-m-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-m-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-m-font-style);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { css } from '@salutejs/plasma-new-hope/styled-components';
import { viewContainer } from '@salutejs/sdds-themes/tokens/sdds_cs';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { viewContainer } from '@salutejs/sdds-themes/es/tokens/sdds_cs';

export const config = {
variations: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -87,6 +89,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/sdds-dfa/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -87,6 +89,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/sdds-finportal/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ export const config = {
xs: css`
${notificationTokens.closeIconTop}: 0.5rem;
${notificationTokens.closeIconRight}: 0.5rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.375rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0rem;
Expand All @@ -87,6 +89,8 @@ export const config = {
xxs: css`
${notificationTokens.closeIconTop}: 0.8125rem;
${notificationTokens.closeIconRight}: 1rem;
${notificationTokens.closeIconButtonSize}: 1.5rem;
${notificationTokens.closeIconSize}: 1.5rem;
${notificationTokens.padding}: 0.5625rem 1rem 1rem 1rem;
${notificationTokens.textboxPaddingTopWithTopIcon}: 0.1875rem;
Expand Down
2 changes: 2 additions & 0 deletions packages/sdds-serv/src/components/Toast/Toast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const config = {
${toastTokens.maxWidth}: calc(100vw - 5rem);
${toastTokens.padding}: 0.5625rem 0.75rem;
${toastTokens.closeIconButtonSize}: 1rem;
${toastTokens.closeIconSize}: 1.5rem;
${toastTokens.fontFamily}: var(--plasma-typo-body-xs-font-family);
${toastTokens.fontSize}: var(--plasma-typo-body-xs-font-size);
${toastTokens.fontStyle}: var(--plasma-typo-body-xs-font-style);
Expand Down

0 comments on commit 53630d0

Please sign in to comment.