Skip to content

Commit

Permalink
🎨 Only current undertema is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
KenAJoh committed Dec 13, 2023
1 parent 4f23ea9 commit 491f0f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ArticleCard = ({
group,
delay,
innholdstype,
undertema,
currentUndertema,
}: GpArticleT & {
group: "initial" | "lazy";
delay?: number;
Expand Down Expand Up @@ -80,10 +80,12 @@ export const ArticleCard = ({
</div>
<div className="flex gap-2 justify-between items-center mt-6">
<div className="flex gap-3 flex-wrap items-center font-semibold">
<span className="text-deepblue-500 flex gap-05 items-center">
<TagFillIcon aria-hidden />
<span>{undertema}</span>
</span>
{currentUndertema && (
<span className="text-deepblue-500 flex gap-05 items-center">
<TagFillIcon aria-hidden />
<span>{currentUndertema}</span>
</span>
)}
<span className="text-teal-700 flex gap-05 items-center">
<FileFillIcon aria-hidden />
<span>{innholdstype}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export type GpArticleT = {
heading: string;
ingress: string;
undertema: string[];
currentUndertema: string;
slug: string;
innholdstype: string | null;
publishedAt: string | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ function useInitialState(articles: GpGroupedArticlesT): {
const { isReady } = useRouter();

const initialData = isReady
? getArticleList(articles, innholdstypeQuery, undertemaQuery).map(
(x) => x.article
)
? getArticleList(articles, innholdstypeQuery, undertemaQuery).map((x) => ({
...x.article,
currentUndertema: x.undertema,
}))
: [];

return {
Expand Down

0 comments on commit 491f0f9

Please sign in to comment.