diff --git a/src/front/Components/DesignSystem/Alert/index.tsx b/src/front/Components/DesignSystem/Alert/index.tsx index 64d70a5c..ac3c8298 100644 --- a/src/front/Components/DesignSystem/Alert/index.tsx +++ b/src/front/Components/DesignSystem/Alert/index.tsx @@ -7,6 +7,7 @@ import Button, { EButtonSize, EButtonstyletype, EButtonVariant, IButtonProps } f import classNames from "classnames"; import IconButton from "../IconButton"; import useOpenable from "@Front/Hooks/useOpenable"; +import BadgeIcon, { EBadgeColor } from "../BadgeIcon"; type IProps = { variant: EAlertVariant; @@ -35,6 +36,14 @@ const variantButtonMap: Record = { [EAlertVariant.NEUTRAL]: EButtonVariant.NEUTRAL, }; +const variantColorMap: Record = { + [EAlertVariant.INFO]: EBadgeColor.INFO, + [EAlertVariant.SUCCESS]: EBadgeColor.SUCCESS, + [EAlertVariant.WARNING]: EBadgeColor.WARNING, + [EAlertVariant.ERROR]: EBadgeColor.ERROR, + [EAlertVariant.NEUTRAL]: EBadgeColor.NEUTRAL, +}; + export default function Alert(props: IProps) { const { isOpen, close } = useOpenable({ defaultOpen: true }); const { variant = EAlertVariant.INFO, title, description, firstButton, secondButton, closeButton, icon, fullWidth } = props; @@ -43,7 +52,7 @@ export default function Alert(props: IProps) { return (
- {icon ?? } + } color={variantColorMap[variant]} />
diff --git a/src/front/Components/DesignSystem/BadgeIcon/classes.module.scss b/src/front/Components/DesignSystem/BadgeIcon/classes.module.scss new file mode 100644 index 00000000..d5fdf0b8 --- /dev/null +++ b/src/front/Components/DesignSystem/BadgeIcon/classes.module.scss @@ -0,0 +1,46 @@ +@import "@Themes/constants.scss"; + +.root { + display: flex; + padding: var(--spacing-1, 8px); + align-items: center; + align-self: flex-start; + + border-radius: var(--alerts-badge-radius, 360px); + border: 1px solid var(--alerts-badge-border, rgba(0, 0, 0, 0)); + background: var(--alerts-badge-background, #fff); + box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.1); + + svg { + width: 24px; + height: 24px; + min-width: 24px; + min-height: 24px; + + stroke: var(--alerts-badge-contrast-info); + } + + &.error { + svg { + stroke: var(--alerts-badge-contrast-error); + } + } + + &.warning { + svg { + stroke: var(--alerts-badge-contrast-warning); + } + } + + &.success { + svg { + stroke: var(--alerts-badge-contrast-success); + } + } + + &.neutral { + svg { + stroke: var(--alerts-badge-contrast-neutral); + } + } +} diff --git a/src/front/Components/DesignSystem/BadgeIcon/index.tsx b/src/front/Components/DesignSystem/BadgeIcon/index.tsx new file mode 100644 index 00000000..9b46963a --- /dev/null +++ b/src/front/Components/DesignSystem/BadgeIcon/index.tsx @@ -0,0 +1,23 @@ +import classNames from "classnames"; +import React from "react"; + +import classes from "./classes.module.scss"; + +export enum EBadgeColor { + INFO = "info", + SUCCESS = "success", + WARNING = "warning", + ERROR = "error", + NEUTRAL = "neutral", +} + +type IProps = { + icon: React.ReactNode; + color: EBadgeColor; +}; + +export default function BadgeIcon(props: IProps) { + const { icon, color } = props; + + return
{icon}
; +} diff --git a/src/front/Components/DesignSystem/Toaster/ToastContent/classes.module.scss b/src/front/Components/DesignSystem/Toaster/ToastContent/classes.module.scss new file mode 100644 index 00000000..51761669 --- /dev/null +++ b/src/front/Components/DesignSystem/Toaster/ToastContent/classes.module.scss @@ -0,0 +1,5 @@ +.root { + display: flex; + align-items: center; + gap: var(--spacing-lg, 24px); +} diff --git a/src/front/Components/DesignSystem/Toaster/ToastContent/index.tsx b/src/front/Components/DesignSystem/Toaster/ToastContent/index.tsx new file mode 100644 index 00000000..eec4e7ef --- /dev/null +++ b/src/front/Components/DesignSystem/Toaster/ToastContent/index.tsx @@ -0,0 +1,28 @@ +import React from "react"; + +import Typography, { ETypo, ETypoColor } from "../../Typography"; +import classes from "./classes.module.scss"; + +type IProps = { + title: string; + description?: string; + icon?: React.ReactNode; +}; + +export default function ToastContent(props: IProps) { + const { icon, title, description } = props; + + return ( +
+ {icon} +
+ + {title} + + + {description} + +
+
+ ); +} diff --git a/src/front/Components/DesignSystem/Toaster/classes.module.scss b/src/front/Components/DesignSystem/Toaster/classes.module.scss new file mode 100644 index 00000000..1fcb7ab0 --- /dev/null +++ b/src/front/Components/DesignSystem/Toaster/classes.module.scss @@ -0,0 +1,23 @@ +.root { + width: fit-content !important; + .wrapper { + width: 387px; + + display: flex; + align-items: center; + + padding: var(--spacing-2, 16px); + border-radius: var(--toaster-radius, 0px); + border: 1px solid var(--toaster-border, #e5eefa); + background: var(--toaster-background, #fff); + /* shadow/sm */ + box-shadow: 0px 4px 16px 0px rgba(0, 0, 0, 0.1); + + .body { + } + + .progress { + height: 2px; + } + } +} diff --git a/src/front/Components/DesignSystem/Toaster/index.tsx b/src/front/Components/DesignSystem/Toaster/index.tsx new file mode 100644 index 00000000..b5af618d --- /dev/null +++ b/src/front/Components/DesignSystem/Toaster/index.tsx @@ -0,0 +1,111 @@ +import { ArrowLeftStartOnRectangleIcon, CheckIcon, ExclamationTriangleIcon, InformationCircleIcon, XMarkIcon } from "@heroicons/react/24/outline"; +import React from "react"; +import { toast, ToastContainer } from "react-toastify"; + +import BadgeIcon, { EBadgeColor } from "../BadgeIcon"; +import IconButton from "../IconButton"; +import Loader from "../Loader"; +import classes from "./classes.module.scss"; +import ToastContent from "./ToastContent"; + +import "react-toastify/dist/ReactToastify.css"; + +export default function Toaster() { + return ( + } />} + /> + ); +} + +export class ToasterService { + private static instance: ToasterService; + private constructor() {} + + public static getInstance() { + return (this.instance ??= new this()); + } + + public text({ title, description }: { title: string; description?: string }) { + toast.info(, { + icon: false, + progressStyle: { backgroundColor: "var(--primary-default-base)" }, + }); + } + + public info({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.INFO} />} + />, + { + icon: false, + progressStyle: { backgroundColor: "var(--info-default-base)" }, + }, + ); + } + + public success({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.SUCCESS} />} />, + { + icon: false, + progressStyle: { backgroundColor: "var(--success-default-base)" }, + }, + ); + } + + public error({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.ERROR} />} />, + { + icon: false, + progressStyle: { backgroundColor: "var(--error-default-base)" }, + }, + ); + } + + public warning({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.WARNING} />} + />, + { + icon: false, + progressStyle: { backgroundColor: "var(--warning-default-base)" }, + }, + ); + } + + public loading({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.INFO} />} />, + { + icon: false, + autoClose: false, + }, + ); + } + + public loggedOut({ title, description }: { title: string; description?: string }) { + toast.info( + } color={EBadgeColor.NEUTRAL} />} + />, + { + icon: false, + autoClose: false, + }, + ); + } +} diff --git a/src/front/Components/DesignSystem/Typography/index.tsx b/src/front/Components/DesignSystem/Typography/index.tsx index 9ceaf113..2e6167da 100644 --- a/src/front/Components/DesignSystem/Typography/index.tsx +++ b/src/front/Components/DesignSystem/Typography/index.tsx @@ -169,6 +169,9 @@ export enum ETypoColor { TAG_SUCCESS_CONTRAST = "--tag-success-contrast", TAG_WARNING_CONTRAST = "--tag-warning-contrast", TAG_ERROR_CONTRAST = "--tag-error-contrast", + + TOASTER_CONTRAST_TITLE = "--toaster-contrast-title", + TOASTER_CONTRAST_TEXT = "--toaster-contrast-text", } export default function Typography(props: IProps) { diff --git a/src/front/Components/LayoutTemplates/DefaultLayout.tsx b/src/front/Components/LayoutTemplates/DefaultLayout.tsx index 322f5bd3..b5e81b75 100644 --- a/src/front/Components/LayoutTemplates/DefaultLayout.tsx +++ b/src/front/Components/LayoutTemplates/DefaultLayout.tsx @@ -1,8 +1,9 @@ import Head from "next/head"; import { ReactNode } from "react"; +import Toaster from "../DesignSystem/Toaster"; + type DefaultLayoutProps = { children: ReactNode }; -import { ToastContainer } from "react-toastify"; -import "react-toastify/dist/ReactToastify.css"; + export const DefaultLayout = ({ children }: DefaultLayoutProps) => { return ( <> @@ -12,7 +13,7 @@ export const DefaultLayout = ({ children }: DefaultLayoutProps) => {
{children} - +
); diff --git a/src/front/Components/Layouts/DesignSystem/index.tsx b/src/front/Components/Layouts/DesignSystem/index.tsx index c4827956..0cf4f2cd 100644 --- a/src/front/Components/Layouts/DesignSystem/index.tsx +++ b/src/front/Components/Layouts/DesignSystem/index.tsx @@ -2,7 +2,9 @@ import Alert, { EAlertVariant } from "@Front/Components/DesignSystem/Alert"; import Autocomplete from "@Front/Components/DesignSystem/Autocomplete"; import AutocompleteMultiSelect from "@Front/Components/DesignSystem/AutocompleteMultiSelect"; import Button, { EButtonSize, EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; +import CheckboxesInputElement from "@Front/Components/DesignSystem/CheckBox"; import CircleProgress from "@Front/Components/DesignSystem/CircleProgress"; +import DragAndDrop from "@Front/Components/DesignSystem/DragAndDrop"; import Dropdown from "@Front/Components/DesignSystem/Dropdown"; import Footer from "@Front/Components/DesignSystem/Footer"; import Form from "@Front/Components/DesignSystem/Form"; @@ -12,10 +14,13 @@ import IconButton, { EIconButtonVariant } from "@Front/Components/DesignSystem/I import Menu from "@Front/Components/DesignSystem/Menu"; import Modal from "@Front/Components/DesignSystem/Modal"; import Newsletter from "@Front/Components/DesignSystem/Newsletter"; +import RadioBox from "@Front/Components/DesignSystem/RadioBox"; import SearchBlockList from "@Front/Components/DesignSystem/SearchBlockList"; import DropdownNavigation from "@Front/Components/DesignSystem/SearchBlockList/DropdownNavigation"; +import Separator, { ESeperatorColor, ESeperatorDirection } from "@Front/Components/DesignSystem/Separator"; import Table from "@Front/Components/DesignSystem/Table"; import Tag, { ETagColor, ETagVariant } from "@Front/Components/DesignSystem/Tag"; +import Toggle, { EToggleSize } from "@Front/Components/DesignSystem/Toggle"; import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; import NumberPicker from "@Front/Components/Elements/NumberPicker"; import Tabs from "@Front/Components/Elements/Tabs"; @@ -33,11 +38,7 @@ import { import { useCallback, useMemo, useState } from "react"; import classes from "./classes.module.scss"; -import CheckboxesInputElement from "@Front/Components/DesignSystem/CheckBox"; -import RadioBox from "@Front/Components/DesignSystem/RadioBox"; -import Toggle, { EToggleSize } from "@Front/Components/DesignSystem/Toggle"; -import Separator, { ESeperatorColor, ESeperatorDirection } from "@Front/Components/DesignSystem/Separator"; -import DragAndDrop from "@Front/Components/DesignSystem/DragAndDrop"; +import { ToasterService } from "@Front/Components/DesignSystem/Toaster"; export default function DesignSystem() { const { isOpen, open, close } = useOpenable(); @@ -89,6 +90,46 @@ export default function DesignSystem() {
DesignSystem
+ Toast +
+ + + +
+
+ + + +
+ Drag and Drop Separators