From dc143b4c103c0b0f82d664a8422e800d28fa48b0 Mon Sep 17 00:00:00 2001 From: Przemek Wiktorski Date: Wed, 28 Feb 2024 10:52:37 +0100 Subject: [PATCH] notifications (#323) * notifications * notifications --------- Co-authored-by: Przemek --- .../Icon/_components/IconsDictionary.tsx | 13 ++ .../molecules/Notification/Notification.tsx | 112 +++++++----------- 2 files changed, 59 insertions(+), 66 deletions(-) diff --git a/src/components/atoms/Icon/_components/IconsDictionary.tsx b/src/components/atoms/Icon/_components/IconsDictionary.tsx index 9a2dda9a..7392aecc 100644 --- a/src/components/atoms/Icon/_components/IconsDictionary.tsx +++ b/src/components/atoms/Icon/_components/IconsDictionary.tsx @@ -15,6 +15,18 @@ const Chevron: React.FC = () => ( ); +const Close = () => ( + + + +); + const Hamburger: React.FC = () => ( ` @@ -31,61 +31,38 @@ const StyledNotification = styled.section<{ getStylesBasedOnTheme( theme.mode, theme.dm__cardBackgroundColor, - theme.cardBackgroundColor + theme.white )}; display: flex; - width: 100%; + flex-direction: column; align-items: flex-start; border-radius: ${({ theme }) => theme.cardRadius}px; - padding: ${({ modularView }) => (modularView ? "0" : "23px 68px 24px 17px")}; - justify-content: ${(props) => - props.modularView ? "space-between" : "flex-start"}; - ${(props) => - props.unread && - css` - &:before { - content: ""; - display: block; - width: 11px; - height: 11px; - margin-top: 3px; - line-height: 19px; - border-radius: 100%; - background-color: ${({ theme }) => - getStylesBasedOnTheme( - theme.mode, - theme.dm__primaryColor, - theme.primaryColor, - theme.primaryColor - )}; - margin-right: 12px; - } - `} - ${(props) => - props.modularView && - props.unread && - css` - &:before { - content: ""; - display: block; - width: 11px; - height: 11px; - line-height: 19px; - border-radius: 100%; - position: absolute; - background-color: ${({ theme }) => - getStylesBasedOnTheme( - theme.mode, - theme.dm__primaryColor, - theme.primaryColor, - theme.primaryColor - )}; - top: 4px; - margin-top: 0; - left: -23px; + padding: 7px 12px; + justify-content: flex-start; + p { + margin: 0; + } + .header { + display: flex; + justify-content: space-between; + width: 100%; + margin-bottom: 5px; + button { + all: unset; + cursor: pointer; + svg { + width: 10px; + height: 10px; + + path { + fill: ${({ theme }) => theme.textColor}; + } } - `} - + } + p { + margin: 0; + } + } .date { display: inline-block; opacity: 0.8; @@ -93,6 +70,11 @@ const StyledNotification = styled.section<{ text-align: left; margin-left: ${({ modularView }) => (modularView ? "38px" : "auto")}; } + .content { + * { + word-break: break-word; + } + } `; export const Notification: React.FC = ({ @@ -109,27 +91,25 @@ export const Notification: React.FC = ({ className={`wellms-component ${className}`} unread={unread} modularView={modularView} - onClick={onClick} > -
- + <div className="header"> + <Text size={"12"} className={"date"}> + {format(dateTime, isToday(dateTime) ? "hh:mm" : "dd.MM.yyyy")} + </Text> + <button onClick={onClick} title={"notification-read"}> + <Icon name="close" /> + </button> + </div> + <div className="content"> + <Text size="13" bold={unread}> {title} - + {maxLengthDesc && description.length > maxLengthDesc ? `${description.substring(0, maxLengthDesc)}...` : description}
- - {format(dateTime, isToday(dateTime) ? "hh:mm" : "dd.MM.yyyy")} - ); };