Skip to content

Commit

Permalink
feat(design-system,web): Move icons (#5677)
Browse files Browse the repository at this point in the history
* feat: Add react-icons

* docs: Deprecate all the things!

* refactor: Move icons export to `@novu/novui/icons`
  • Loading branch information
Joel Anton authored Jun 4, 2024
1 parent 9de2dcb commit 9d4d28d
Show file tree
Hide file tree
Showing 18 changed files with 17,910 additions and 354 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/components/layout/components/v2/HeaderNav.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ActionIcon, Header } from '@mantine/core';

import { IconHelpOutline, Tooltip } from '@novu/design-system';
import { IconHelpOutline } from '@novu/novui/icons';
import { Tooltip } from '@novu/design-system';
import { IS_DOCKER_HOSTED } from '../../../../config';
import { useBootIntercom } from '../../../../hooks';
import useThemeChange from '../../../../hooks/useThemeChange';
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/hooks/useThemeChange.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColorScheme, useMantineColorScheme } from '@mantine/core';
import { IconDarkMode, IconLightMode, IconTonality } from '@novu/design-system';
import { IconOutlineDarkMode, IconOutlineLightMode, IconOutlineTonality } from '@novu/novui/icons';
import { ColorSchemePreferenceEnum, THEME_TITLE_LOOKUP, useLocalThemePreference, useSegment } from '@novu/shared-web';
import { useEffect, useMemo } from 'react';
import { useDebounce } from './useDebounce';
Expand All @@ -8,13 +8,13 @@ type ThemeChange = { colorScheme: ColorScheme; themeStatus: ColorSchemePreferenc

const getThemeIcon = (themeStatus: ColorSchemePreferenceEnum) => {
if (themeStatus === ColorSchemePreferenceEnum.DARK) {
return <IconDarkMode />;
return <IconOutlineDarkMode />;
}
if (themeStatus === ColorSchemePreferenceEnum.LIGHT) {
return <IconLightMode />;
return <IconOutlineLightMode />;
}

return <IconTonality />;
return <IconOutlineTonality />;
};

export default function useThemeChange() {
Expand Down
22 changes: 19 additions & 3 deletions libs/design-system/src/iconsV2/Icon.types.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
import { CSSProperties, SVGAttributes } from 'react';

/** Icon Size in pixels (to be replaced with values directly from Design System) */
/**
* @deprecated Use @novu/novui/icons instead.
* Icon Size in pixels (to be replaced with values directly from Design System)
*/
export type IconSize = '16' | '20' | '24';

/** A temporary type that accepts a typical CSS color until we have our strict Design System types defined */
/**
* @deprecated Use @novu/novui/icons instead.
* A temporary type that accepts a typical CSS color until we have our strict Design System types defined
*/
type UnsafeIconColor = CSSProperties['color'];

/** @deprecated Use @novu/novui/icons instead. */
export interface IIconStyleProps {
/**
*
* @deprecated Use @novu/novui/icons instead.
* Default: '20px'.
*
* The actual display size in pixels.
*/
size?: IconSize;
/**
*
* @deprecated Use @novu/novui/icons instead.
* Default: B60
*
* WARNING: this is only to be used with colors from the design system, and will later be enforced more strictly
*/
color?: UnsafeIconColor;
}

/** @deprecated Use @novu/novui/icons instead. */
export interface IIconProps extends Omit<SVGAttributes<SVGElement>, 'color'>, IIconStyleProps {
/** Description for accessibility. This is mandatory so that we make a11y a priority with icons */
/**
* Description for accessibility. This is mandatory so that we make a11y a priority with icons
*/
title: string;
}

/** @deprecated Use @novu/novui/icons instead. */
export type IconType = (props: IIconProps) => JSX.Element;
Loading

0 comments on commit 9d4d28d

Please sign in to comment.