From 28e6ced1983be29023c98a2acacafad650e1c0ef Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Wed, 22 Feb 2023 10:25:00 +0100 Subject: [PATCH] :construction: WIP notification modal --- .../NotificationModal/classes.module.scss | 19 ++++++++ .../Notifications/NotificationModal/index.tsx | 43 +++++++++++++++++++ .../Header/Notifications/classes.module.scss | 19 ++++++-- .../Header/Notifications/index.tsx | 20 ++++++++- .../components/Layouts/DesignSystem/index.tsx | 1 - 5 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 src/front/components/DesignSystem/Header/Notifications/NotificationModal/classes.module.scss create mode 100644 src/front/components/DesignSystem/Header/Notifications/NotificationModal/index.tsx diff --git a/src/front/components/DesignSystem/Header/Notifications/NotificationModal/classes.module.scss b/src/front/components/DesignSystem/Header/Notifications/NotificationModal/classes.module.scss new file mode 100644 index 00000000..c08af237 --- /dev/null +++ b/src/front/components/DesignSystem/Header/Notifications/NotificationModal/classes.module.scss @@ -0,0 +1,19 @@ +@import "@Themes/constants.scss"; + +.root { + width: 300px; + height: 500px; + background-color: $orange-flash; + padding: 24px; + position: absolute; + top: 107px; + right:56px; + .notification-header{ + width: 100%; + display: inline-flex; + justify-content: space-between; + .close-icon{ + cursor: pointer; + } + } +} diff --git a/src/front/components/DesignSystem/Header/Notifications/NotificationModal/index.tsx b/src/front/components/DesignSystem/Header/Notifications/NotificationModal/index.tsx new file mode 100644 index 00000000..5fe14d48 --- /dev/null +++ b/src/front/components/DesignSystem/Header/Notifications/NotificationModal/index.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import classes from "./classes.module.scss"; +import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; +import CloseIcon from "@Assets/icons/cross.svg"; +import Image from "next/image"; + +type IProps = { + openModal: () => void; +}; +type IState = { + isModalOpen: boolean; +}; + +export default class NotificationModal extends React.Component { + constructor(props: IProps) { + super(props); + this.state = { + isModalOpen: true, + }; + this.closeModal = this.closeModal.bind(this); + this.openModal = this.openModal.bind(this); + } + + public override render(): JSX.Element | null { + if (!this.state.isModalOpen) return null; + return
+
+ + Notifications + +
+ Close notification modal +
+
; +
+ } + private closeModal() { + this.setState({ isModalOpen: false }); + } + private openModal() { + this.setState({ isModalOpen: true }); + } +} diff --git a/src/front/components/DesignSystem/Header/Notifications/classes.module.scss b/src/front/components/DesignSystem/Header/Notifications/classes.module.scss index 9501ac5b..b043ec9b 100644 --- a/src/front/components/DesignSystem/Header/Notifications/classes.module.scss +++ b/src/front/components/DesignSystem/Header/Notifications/classes.module.scss @@ -1,8 +1,21 @@ @import "@Themes/constants.scss"; .root { - .notification-icon{ - height: 24px; - width: 24px; + .icon-container{ + position: relative; + + .notification-icon{ + height: 24px; + width: 24px; + } + .notification-dot{ + position: absolute; + top: 0; + right: 0; + height: 12px; + width: 12px; + border-radius: 50%; + background-color: $orange-flash; + } } } diff --git a/src/front/components/DesignSystem/Header/Notifications/index.tsx b/src/front/components/DesignSystem/Header/Notifications/index.tsx index 3bf7144d..4ee4b44d 100644 --- a/src/front/components/DesignSystem/Header/Notifications/index.tsx +++ b/src/front/components/DesignSystem/Header/Notifications/index.tsx @@ -2,19 +2,37 @@ import React from "react"; import classes from "./classes.module.scss"; import Image from "next/image"; import NotificationIcon from "@Assets/icons/notification.svg"; +import Toasts from "@Front/Stores/Toasts"; +import NotificationModal from "./NotificationModal"; type IProps = {}; type IState = { hasNotifications: boolean; + isModalOpen: boolean; }; export default class Notifications extends React.Component { + constructor(props: IProps) { + super(props); + this.state = { + hasNotifications: true, + isModalOpen: true, + }; + this.opeModal = this.opeModal.bind(this); + } public override render(): JSX.Element { + const hasNotifications = Toasts.getInstance().toasts.length; + console.log(hasNotifications) return
-
+
notifications + {this.state.hasNotifications &&
}
+ { this.state.isModalOpen && }
; } + private opeModal() { + this.setState({ isModalOpen: true }); + }; } diff --git a/src/front/components/Layouts/DesignSystem/index.tsx b/src/front/components/Layouts/DesignSystem/index.tsx index bb39a324..eb5df678 100644 --- a/src/front/components/Layouts/DesignSystem/index.tsx +++ b/src/front/components/Layouts/DesignSystem/index.tsx @@ -106,7 +106,6 @@ export default class DesignSystem extends BasePage { private spawnToast() { - console.log('spawn toast') const toast: IToast = { title: "Un collaborateur veut rejoindre votre office", text: "12:00 - 1 fev 2023" } Toasts.getInstance().open(toast) }