From 4aff3a702c0dc19f98e20d2f2cf27f29506fc11a Mon Sep 17 00:00:00 2001 From: Maksim Eltyshev Date: Sun, 20 Nov 2022 15:30:07 +0100 Subject: [PATCH] fix: Fix notifications popup styles --- .../components/Header/NotificationsPopup.jsx | 32 +++++++++++------- .../Header/NotificationsPopup.module.scss | 33 +++++++++++++++---- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/client/src/components/Header/NotificationsPopup.jsx b/client/src/components/Header/NotificationsPopup.jsx index ff98a66b..f81a1538 100755 --- a/client/src/components/Header/NotificationsPopup.jsx +++ b/client/src/components/Header/NotificationsPopup.jsx @@ -1,3 +1,4 @@ +import truncate from 'lodash/truncate'; import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; import { useTranslation, Trans } from 'react-i18next'; @@ -47,23 +48,26 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => { {activity.data.toList.name} ); - case ActivityTypes.COMMENT_CARD: + case ActivityTypes.COMMENT_CARD: { + const commentText = truncate(activity.data.text); + return ( {activity.user.name} - {` left a new comment «${activity.data.text}» to `} + {` left a new comment «${commentText}» to `} {card.name} ); + } default: } @@ -80,9 +84,10 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => { })} - {items.length > 0 - ? items.map((item) => ( -
+ {items.length > 0 ? ( +
+ {items.map((item) => ( +
{item.card && item.activity ? ( <> { avatarUrl={item.activity.user.avatarUrl} size="large" /> - {renderItemContent(item)} + {renderItemContent(item)} ) : ( -
{t('common.cardOrActionAreDeleted')}
+
{t('common.cardOrActionAreDeleted')}
)}
- )) - : t('common.noUnreadNotifications')} + ))} +
+ ) : ( + t('common.noUnreadNotifications') + )} ); diff --git a/client/src/components/Header/NotificationsPopup.module.scss b/client/src/components/Header/NotificationsPopup.module.scss index 62dd9a7a..cdad65b7 100644 --- a/client/src/components/Header/NotificationsPopup.module.scss +++ b/client/src/components/Header/NotificationsPopup.module.scss @@ -1,5 +1,13 @@ :global(#app) { - .button { + .item { + padding: 12px; + + &:hover { + background: #f0f0f0; + } + } + + .itemButton { background: transparent; box-shadow: none; float: right; @@ -7,7 +15,7 @@ line-height: 20px; margin: 0; min-height: auto; - padding: 5px 0; + padding: 0; transition: background 0.3s ease; width: 20px; @@ -16,7 +24,7 @@ } } - .content { + .itemContent { display: inline-block; font-size: 12px; min-height: 36px; @@ -27,7 +35,7 @@ word-break: break-word; } - .deletedContent { + .itemDeleted { display: inline-block; line-height: 20px; min-height: 20px; @@ -38,10 +46,21 @@ .wrapper { margin: 0 -12px; - padding: 12px; + max-height: 60vh; + overflow-x: hidden; + overflow-y: auto; + scrollbar-width: thin; - &:hover { - background: #f0f0f0; + &::-webkit-scrollbar { + width: 5px; + } + + &::-webkit-scrollbar-track { + background: transparent; + } + + &::-webkit-scrollbar-thumb { + border-radius: 3px; } } }