diff --git a/apps/portals/my-pages/src/components/Notifications/NotificationButton.tsx b/apps/portals/my-pages/src/components/Notifications/NotificationButton.tsx index ea6b2822ecd1..6578da5520c9 100644 --- a/apps/portals/my-pages/src/components/Notifications/NotificationButton.tsx +++ b/apps/portals/my-pages/src/components/Notifications/NotificationButton.tsx @@ -28,7 +28,7 @@ const NotificationButton = ({ const [hasMarkedLocally, setHasMarkedLocally] = useState(false) const [markAllAsSeen] = useMarkAllNotificationsAsSeenMutation() const { width } = useWindowSize() - const isMobile = width < theme.breakpoints.md + const isTablet = width < theme.breakpoints.lg const ref = useRef(null) const { data, refetch } = useGetUserNotificationsOverviewQuery({ @@ -64,10 +64,10 @@ const NotificationButton = ({ variant="utility" colorScheme="white" disabled={disabled} - icon={showMenu && isMobile ? 'close' : 'notifications'} + icon={showMenu && isTablet ? 'close' : 'notifications'} iconType="outline" onClick={() => { - showMenu && isMobile + showMenu && isTablet ? setMenuState(undefined) : setMenuState('notifications') }} diff --git a/apps/portals/my-pages/src/components/Notifications/NotificationLine.tsx b/apps/portals/my-pages/src/components/Notifications/NotificationLine.tsx index 3eaa46afa5ce..0e74dcc01a82 100644 --- a/apps/portals/my-pages/src/components/Notifications/NotificationLine.tsx +++ b/apps/portals/my-pages/src/components/Notifications/NotificationLine.tsx @@ -15,6 +15,8 @@ import { COAT_OF_ARMS, resolveLink, } from '@island.is/portals/my-pages/information' +import { useWindowSize } from 'react-use' +import { theme } from '@island.is/island-ui/theme' interface Props { data: { @@ -26,6 +28,10 @@ interface Props { } export const NotificationLine = ({ data, onClickCallback }: Props) => { + const { width } = useWindowSize() + + const isMobile = width < theme.breakpoints.md + const date = data.metadata?.created ? format(new Date(data.metadata.created), dateFormat.is) : '' @@ -44,7 +50,7 @@ export const NotificationLine = ({ data, onClickCallback }: Props) => { position="relative" borderColor="blue200" borderBottomWidth="standard" - paddingX={2} + padding={2} width="full" className={cn(styles.line, { [styles.unread]: !isRead, @@ -60,7 +66,7 @@ export const NotificationLine = ({ data, onClickCallback }: Props) => { width="full" display="flex" flexDirection="column" - paddingLeft={2} + paddingLeft={isMobile ? 'p2' : 2} minWidth={0} > { > {data.message.title} - {date} + {date} { flexDirection="row" justifyContent="spaceBetween" > - {data.message.displayBody} + + {data.message.displayBody} + diff --git a/apps/portals/my-pages/src/components/Notifications/NotificationMenu.tsx b/apps/portals/my-pages/src/components/Notifications/NotificationMenu.tsx index d7d1b40639e1..130c582f0ecf 100644 --- a/apps/portals/my-pages/src/components/Notifications/NotificationMenu.tsx +++ b/apps/portals/my-pages/src/components/Notifications/NotificationMenu.tsx @@ -40,6 +40,7 @@ const NotificationMenu = ({ const { width } = useWindowSize() const isMobile = width < theme.breakpoints.md + const isTablet = width < theme.breakpoints.lg && !isMobile const onClose = () => { closeNotificationMenu() @@ -51,7 +52,7 @@ const NotificationMenu = ({ onClick={onClose} aria-label={formatMessage(sharedMessages.close)} > - + ) @@ -60,17 +61,17 @@ const NotificationMenu = ({ ))} @@ -125,7 +128,7 @@ const NotificationMenu = ({ ) @@ -89,7 +89,7 @@ const Sidemenu = ({ justifyContent="center" alignItems="center" className={styles.overviewIcon} - marginRight={2} + marginRight={'p2'} >