Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(my-pages): notifications spacing and color #16696

Merged
merged 18 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const NotificationButton = ({
const [hasMarkedLocally, setHasMarkedLocally] = useState(false)
const [markAllAsSeen] = useMarkAllNotificationsAsSeenMutation()
const { width } = useWindowSize()
const isMobile = width < theme.breakpoints.md
const isMobile = width < theme.breakpoints.lg
disaerna marked this conversation as resolved.
Show resolved Hide resolved
disaerna marked this conversation as resolved.
Show resolved Hide resolved
disaerna marked this conversation as resolved.
Show resolved Hide resolved
const ref = useRef<HTMLButtonElement>(null)

const { data, refetch } = useGetUserNotificationsOverviewQuery({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
disaerna marked this conversation as resolved.
Show resolved Hide resolved
disaerna marked this conversation as resolved.
Show resolved Hide resolved

interface Props {
data: {
Expand All @@ -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)
: ''
Expand All @@ -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,
Expand All @@ -60,7 +66,7 @@ export const NotificationLine = ({ data, onClickCallback }: Props) => {
width="full"
display="flex"
flexDirection="column"
paddingLeft={2}
paddingLeft={isMobile ? 'p2' : 2}
minWidth={0}
>
<Box
Expand All @@ -70,21 +76,23 @@ export const NotificationLine = ({ data, onClickCallback }: Props) => {
>
<Text
fontWeight={isRead ? 'regular' : 'medium'}
variant="medium"
variant={isMobile ? 'default' : 'medium'}
color="blue400"
truncate
>
{data.message.title}
</Text>
<Text variant="small">{date}</Text>
<Text variant={isMobile ? 'medium' : 'small'}>{date}</Text>
</Box>
<Box
marginTop={1}
display="flex"
flexDirection="row"
justifyContent="spaceBetween"
>
<Text variant="small">{data.message.displayBody}</Text>
<Text variant={isMobile ? 'medium' : 'small'}>
{data.message.displayBody}
</Text>
</Box>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const NotificationMenu = ({
const { width } = useWindowSize()

const isMobile = width < theme.breakpoints.md
const isTablet = width < theme.breakpoints.lg && !isMobile
disaerna marked this conversation as resolved.
Show resolved Hide resolved

const onClose = () => {
closeNotificationMenu()
Expand All @@ -51,7 +52,7 @@ const NotificationMenu = ({
onClick={onClose}
aria-label={formatMessage(sharedMessages.close)}
>
<Icon icon="close" color="blue400" />
<Icon icon="close" color="blue600" />
</button>
)

Expand All @@ -60,17 +61,17 @@ const NotificationMenu = ({
<Box
position="relative"
background="white"
padding={2}
padding={isMobile || isTablet ? 0 : 2}
disaerna marked this conversation as resolved.
Show resolved Hide resolved
borderRadius="large"
display="flex"
flexDirection="column"
height={isMobile ? 'full' : undefined}
className={cn(
isMobile ? mStyles.fullScreen : mStyles.dropdown,
isMobile || isTablet ? mStyles.fullScreen : mStyles.dropdown,
mStyles.container,
)}
style={
!isMobile
!isMobile && !isTablet
? {
left: rightPosition ?? '75%',
transform: 'translateX(-100%)',
Expand All @@ -85,6 +86,8 @@ const NotificationMenu = ({
alignItems="center"
marginBottom={1}
marginTop={2}
marginRight={2}
marginLeft={2}
>
<Box
borderRadius="full"
Expand All @@ -93,7 +96,7 @@ const NotificationMenu = ({
justifyContent="center"
alignItems="center"
className={mStyles.overviewIcon}
marginRight={1}
marginRight="p2"
>
<Icon
icon="notifications"
Expand All @@ -113,8 +116,8 @@ const NotificationMenu = ({
/>
))}
<Box
paddingTop={2}
paddingBottom={1}
paddingTop={3}
paddingBottom={2}
textAlign="center"
width="full"
>
Expand All @@ -125,7 +128,7 @@ const NotificationMenu = ({
<Button
icon="arrowForward"
iconType="filled"
size="medium"
size="small"
type="text"
variant="text"
unfocusable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ export const lineWrapper = style({
})

export const line = style({
paddingTop: theme.spacing.smallGutter * 3,
paddingBottom: theme.spacing.smallGutter * 3,
selectors: {
'&:hover': {
backgroundColor: theme.color.blue100,
Expand Down
14 changes: 12 additions & 2 deletions apps/portals/my-pages/src/components/Sidemenu/Sidemenu.css.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { spacing, theme, themeUtils } from '@island.is/island-ui/theme'
import { keyframes, style, styleVariants } from '@vanilla-extract/css'
import {
globalStyle,
keyframes,
style,
styleVariants,
} from '@vanilla-extract/css'
import { StyleWithSelectors } from '@vanilla-extract/css/dist/declarations/src/types'

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -161,7 +166,8 @@ export const closeButton = style({
transition: 'background-color 250ms, border-color 250ms',

':hover': {
backgroundColor: theme.color.dark100,
backgroundColor: theme.color.blue100,
color: theme.color.blue400,
},

':focus': {
Expand All @@ -170,6 +176,10 @@ export const closeButton = style({
},
})

globalStyle(`${closeButton}:hover > svg`, {
color: theme.color.blue400,
})

export const itemLink = style({
width: '100%',
':hover': {
Expand Down
4 changes: 2 additions & 2 deletions apps/portals/my-pages/src/components/Sidemenu/Sidemenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Sidemenu = ({
onClick={() => setSideMenuOpen(false)}
aria-label={formatMessage(sharedMessages.close)}
>
<Icon icon="close" color="blue400" />
<Icon icon="close" color="blue600" />
</button>
)

Expand Down Expand Up @@ -89,7 +89,7 @@ const Sidemenu = ({
justifyContent="center"
alignItems="center"
className={styles.overviewIcon}
marginRight={2}
marginRight={'p2'}
disaerna marked this conversation as resolved.
Show resolved Hide resolved
>
<Icon icon="dots" />
</Box>
Expand Down
Loading