From e971654c025281a9b542e1b00c152c4f9d2bc804 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Thu, 12 Dec 2024 22:23:31 +0800 Subject: [PATCH] chore: sentence case category --- .../next/layouts/Collection/Collection.stories.tsx | 6 +++--- .../src/templates/next/layouts/Collection/Collection.tsx | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/components/src/templates/next/layouts/Collection/Collection.stories.tsx b/packages/components/src/templates/next/layouts/Collection/Collection.stories.tsx index 206514cd11..7e0fb65016 100644 --- a/packages/components/src/templates/next/layouts/Collection/Collection.stories.tsx +++ b/packages/components/src/templates/next/layouts/Collection/Collection.stories.tsx @@ -21,7 +21,7 @@ const COLLECTION_ITEMS: IsomerSitemap[] = flatten( "We’ve looked at how people’s spending correlates with how much microscopic plastic they consumed over the months. We’ve looked at how people’s spending correlates with how much microscopic plastic they consumed over the months.", date: "07/05/2024", category: "Category Name", - tags: [{ category: "Jokes", values: ["Dad"], selected: ["Dad"] }], + tags: [{ category: "jokes", values: ["Dad"], selected: ["Dad"] }], }, { id: `${index}`, @@ -42,7 +42,7 @@ const COLLECTION_ITEMS: IsomerSitemap[] = flatten( type: "png", size: "1.2MB", }, - tags: [{ category: "Jokes", values: ["Lame"], selected: ["Lame"] }], + tags: [{ category: "jokes", values: ["Lame"], selected: ["Lame"] }], }, { id: `${index}`, @@ -57,7 +57,7 @@ const COLLECTION_ITEMS: IsomerSitemap[] = flatten( ref: "https://guide.isomer.gov.sg", tags: [ { - category: "Jokes", + category: "jokes", values: [ "This is a very long tag that should be reflowed on smaller screens maybe", ], diff --git a/packages/components/src/templates/next/layouts/Collection/Collection.tsx b/packages/components/src/templates/next/layouts/Collection/Collection.tsx index 85134da4f0..75f85633b7 100644 --- a/packages/components/src/templates/next/layouts/Collection/Collection.tsx +++ b/packages/components/src/templates/next/layouts/Collection/Collection.tsx @@ -1,4 +1,5 @@ import type { Exact } from "type-fest" +import capitalize from "lodash/capitalize" import type { CollectionPageSchemaType, IsomerSiteProps } from "~/engine" import type { AllCardProps, ProcessedCollectionCardProps } from "~/interfaces" @@ -66,7 +67,10 @@ const getCollectionItems = ( description: item.summary, image: item.image, site, - tags: item.tags, + tags: item.tags?.map(({ selected, category }) => ({ + selected, + category: capitalize(category), + })), } if (item.layout === "file") {