Skip to content

Commit f72e440

Browse files
Render "new"-badge (#206)
Co-authored-by: PietiKinnunen <106057688+PietiKinnunen@users.noreply.github.com>
1 parent 4bf591f commit f72e440

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

server/sanity.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const navQuery = `
6565
sectionItems[]{
6666
itemType,
6767
"icon": icon.asset->url,
68+
highlightBadge,
6869
title,
6970
description,
7071
link,
@@ -90,6 +91,7 @@ const navQuery = `
9091
sectionItems[]{
9192
itemType,
9293
"icon": icon.asset->url,
94+
highlightBadge,
9395
title,
9496
description,
9597
link,

src/components/DropdownMenu/DropdownMenuItem.module.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@
104104
display: initial;
105105
}
106106
}
107+
108+
.iconWrapper {
109+
display: flex;
110+
flex-direction: column;
111+
row-gap: 8px;
112+
min-width: 35px;
113+
}
114+
107115
.dateText {
108116
font-size: 14px;
109117
line-height: 18px;

src/components/DropdownMenu/DropdownMenuItem.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { clsx } from "clsx";
22

33
import Link from "../Link";
4+
import New from "./assets/new-badge.svg";
45

56
import styles from "./DropdownMenuItem.module.css";
67
import cn from "classnames";
78
export interface MenuItemProps {
89
itemType: string | "normal" | "image";
910
icon?: string | null;
11+
highlightBadge?: boolean | null;
1012
title?: string | null;
1113
description?: string | null;
1214
link: string | null;
@@ -28,6 +30,7 @@ const DropdownMenuItem = ({
2830
title,
2931
link = "",
3032
icon,
33+
highlightBadge = false,
3134
description,
3235
imageItem,
3336
itemAmount,
@@ -39,7 +42,10 @@ const DropdownMenuItem = ({
3942
className={clsx(styles.styledLink, !description && styles.center)}
4043
href={link}
4144
>
42-
<img src={icon || ""} width={35} height={35} alt="" />
45+
<div className={styles.iconWrapper}>
46+
<img src={icon || ""} width={35} height={35} alt="" />
47+
{highlightBadge && <New />}
48+
</div>
4349
<div className={styles.item}>
4450
<p className={styles.itemTitle}>{title}</p>
4551
{description && <p className={styles.description}>{description}</p>}
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)