From eefb0f6aae2e7181a380fa5c96650344920db66f Mon Sep 17 00:00:00 2001 From: Ken Date: Wed, 8 Jan 2025 12:05:59 +0100 Subject: [PATCH] :sparkles: Can now add border to image-module in sanity --- .../components/sanity-modules/bilde/Bilde.tsx | 94 +++++++++---------- .../website/components/types/sanity-schema.ts | 1 + .../sanity/schema/objects/shared/bilde.tsx | 6 ++ 3 files changed, 54 insertions(+), 47 deletions(-) diff --git a/aksel.nav.no/website/components/sanity-modules/bilde/Bilde.tsx b/aksel.nav.no/website/components/sanity-modules/bilde/Bilde.tsx index 094cba1116..30c9680888 100644 --- a/aksel.nav.no/website/components/sanity-modules/bilde/Bilde.tsx +++ b/aksel.nav.no/website/components/sanity-modules/bilde/Bilde.tsx @@ -17,56 +17,56 @@ const Bilde = ({ node, className }: BildeProps) => { } return ( - <> -
+
-
- {!node?.dekorativt -
- {node.caption && ( -
+ {!node?.dekorativt +
+ {node.caption && ( +
+ + {node.caption} + + {node?.kilde?.har_kilde && ( - {node.caption} + {node?.kilde?.link ? ( + <> + {`${node?.kilde?.prefix}: `} + + {node?.kilde?.tekst} + + + ) : ( + <>{`${node?.kilde?.prefix}: ${node?.kilde?.tekst}`} + )} - {node?.kilde?.har_kilde && ( - - {node?.kilde?.link ? ( - <> - {`${node?.kilde?.prefix}: `} - - {node?.kilde?.tekst} - - - ) : ( - <>{`${node?.kilde?.prefix}: ${node?.kilde?.tekst}`} - )} - - )} -
- )} -
- + )} + + )} + ); }; diff --git a/aksel.nav.no/website/components/types/sanity-schema.ts b/aksel.nav.no/website/components/types/sanity-schema.ts index 690e4097f8..2528f82b8a 100644 --- a/aksel.nav.no/website/components/types/sanity-schema.ts +++ b/aksel.nav.no/website/components/types/sanity-schema.ts @@ -248,6 +248,7 @@ export interface BildeT { link?: string; }; dekorativt?: boolean; + border?: boolean; background?: { rgb: { a: number; b: number; g: number; r: number }; alpha: number; diff --git a/aksel.nav.no/website/sanity/schema/objects/shared/bilde.tsx b/aksel.nav.no/website/sanity/schema/objects/shared/bilde.tsx index b155072a9a..fd5219f9ef 100644 --- a/aksel.nav.no/website/sanity/schema/objects/shared/bilde.tsx +++ b/aksel.nav.no/website/sanity/schema/objects/shared/bilde.tsx @@ -79,6 +79,12 @@ export const Bilde = defineType({ type: "boolean", initialValue: false, }), + defineField({ + name: "border", + title: "Border", + type: "boolean", + initialValue: true, + }), defineField({ name: "background", title: "Bakgrunnsfarge",