From c7f9fc57017f758374cac7c9a44b25834aeb2e6a Mon Sep 17 00:00:00 2001 From: PietiKinnunen <106057688+PietiKinnunen@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:10:25 +0300 Subject: [PATCH] Render "new"-badge --- server/sanity.ts | 2 ++ src/components/DropdownMenu/DropdownMenuItem.module.css | 8 ++++++++ src/components/DropdownMenu/DropdownMenuItem.tsx | 8 +++++++- src/components/DropdownMenu/assets/new-badge.svg | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/components/DropdownMenu/assets/new-badge.svg diff --git a/server/sanity.ts b/server/sanity.ts index 833d5d1..218fada 100644 --- a/server/sanity.ts +++ b/server/sanity.ts @@ -65,6 +65,7 @@ const navQuery = ` sectionItems[]{ itemType, "icon": icon.asset->url, + highlightBadge, title, description, link, @@ -90,6 +91,7 @@ const navQuery = ` sectionItems[]{ itemType, "icon": icon.asset->url, + highlightBadge, title, description, link, diff --git a/src/components/DropdownMenu/DropdownMenuItem.module.css b/src/components/DropdownMenu/DropdownMenuItem.module.css index 2d3e6e5..aca0e50 100644 --- a/src/components/DropdownMenu/DropdownMenuItem.module.css +++ b/src/components/DropdownMenu/DropdownMenuItem.module.css @@ -104,6 +104,14 @@ display: initial; } } + +.iconWrapper { + display: flex; + flex-direction: column; + row-gap: 8px; + min-width: 35px; +} + .dateText { font-size: 14px; line-height: 18px; diff --git a/src/components/DropdownMenu/DropdownMenuItem.tsx b/src/components/DropdownMenu/DropdownMenuItem.tsx index c4d8563..71fc5d6 100644 --- a/src/components/DropdownMenu/DropdownMenuItem.tsx +++ b/src/components/DropdownMenu/DropdownMenuItem.tsx @@ -1,12 +1,14 @@ import { clsx } from "clsx"; import Link from "../Link"; +import New from "./assets/new-badge.svg"; import styles from "./DropdownMenuItem.module.css"; import cn from "classnames"; export interface MenuItemProps { itemType: string | "normal" | "image"; icon?: string | null; + highlightBadge?: boolean | null; title?: string | null; description?: string | null; link: string | null; @@ -28,6 +30,7 @@ const DropdownMenuItem = ({ title, link = "", icon, + highlightBadge = false, description, imageItem, itemAmount, @@ -39,7 +42,10 @@ const DropdownMenuItem = ({ className={clsx(styles.styledLink, !description && styles.center)} href={link} > - +
+ + {highlightBadge && } +

{title}

{description &&

{description}

} diff --git a/src/components/DropdownMenu/assets/new-badge.svg b/src/components/DropdownMenu/assets/new-badge.svg new file mode 100644 index 0000000..2e7f32f --- /dev/null +++ b/src/components/DropdownMenu/assets/new-badge.svg @@ -0,0 +1 @@ + \ No newline at end of file