diff --git a/packages/app/src/components/cms/content-image.tsx b/packages/app/src/components/cms/content-image.tsx index 7b33dfaf46..b99dfbe833 100644 --- a/packages/app/src/components/cms/content-image.tsx +++ b/packages/app/src/components/cms/content-image.tsx @@ -6,7 +6,7 @@ import { Box } from '~/components/base'; import { ContentBlock } from '~/components/cms/content-block'; import { SanityImage } from '~/components/cms/sanity-image'; import { getImageProps } from '~/lib/sanity'; -import { space } from '~/style/theme'; +import { space, shadows } from '~/style/theme'; import { ImageBlock, RichContentImageBlock } from '~/types/cms'; import { Text } from '../typography'; @@ -14,6 +14,7 @@ interface ContentImageProps { node: ImageBlock | RichContentImageBlock; contentWrapper?: FunctionComponent; sizes?: string[][]; + enableShadow?: boolean; } const SanityImageTile = styled(SanityImage)( @@ -25,7 +26,7 @@ const SanityImageTile = styled(SanityImage)( const IMAGE_MAX_WIDTH = '980px'; -export function ContentImage({ node, contentWrapper, sizes }: ContentImageProps) { +export function ContentImage({ node, contentWrapper, sizes, enableShadow = false }: ContentImageProps) { const caption = 'caption' in node && node.caption && ( {node.caption} @@ -53,7 +54,9 @@ export function ContentImage({ node, contentWrapper, sizes }: ContentImageProps) ) : ( - {node.asset && } + + {node.asset && } + {caption} diff --git a/packages/app/src/components/fullscreen-chart-tile.tsx b/packages/app/src/components/fullscreen-chart-tile.tsx index e837214494..41809d756a 100644 --- a/packages/app/src/components/fullscreen-chart-tile.tsx +++ b/packages/app/src/components/fullscreen-chart-tile.tsx @@ -19,9 +19,10 @@ interface FullscreenChartTileProps { disabled?: boolean; id?: string; metadata?: MetadataProps; + disableBorder?: boolean; } -export const FullscreenChartTile = ({ children, disabled, id, metadata }: FullscreenChartTileProps) => { +export const FullscreenChartTile = ({ children, disabled, id, metadata, disableBorder }: FullscreenChartTileProps) => { const [isFullscreen, setIsFullscreen] = useState(false); const wasFullscreen = usePrevious(isFullscreen); const breakpoints = useBreakpoints(); @@ -37,7 +38,7 @@ export const FullscreenChartTile = ({ children, disabled, id, metadata }: Fullsc const label = replaceVariablesInText(isFullscreen ? commonTexts.common.modal_close : commonTexts.common.modal_open, { subject: commonTexts.common.grafiek_singular }); const tile = ( - + ((context) => { const { locale = 'nl' } = context; - return ` - *[_type == 'overDitDashboard']{ - ..., - "description": { - "_type": description._type, - "${locale}": [ - ...description.${locale}[] - { - ..., - "asset": asset-> - }, - ] + return `// groq + *[_type == 'overDitDashboard' && !(_id in path('drafts.**'))][0]{ + ..., + "description": { + "_type": description._type, + "${locale}": [ + ...description.${locale}[]{ + ..., + "asset": asset-> + }, + ] + }, + "intro": { + "_type": intro._type, + "${locale}": [ + ...intro.${locale}[]{ + ..., + "asset": asset-> + }, + ] + }, + "timelineImage": { + "_type": timelineImage._type, + "${locale}": { + ...timelineImage.${locale}, + }, + } } - }[0] `; }) ); @@ -49,39 +60,48 @@ const Over = (props: StaticProps) => { return ( - - - - - - - - {content.title && {content.title}} - {content.description && ( - - )} + + + + + + + + + {content.title} + + + +
+ + + + + + +
+
+ +
+
-
+
); }; -const RichContentWrapper = styled.div( - css({ - width: '100%', - }) -); - export default Over; + +const RichContentWrapper = styled('div')` + width: 100%; +`; + +const TwoColumnLayout = styled(Box)` + display: grid; + grid-template-columns: 1fr; + gap: ${space[4]} ${space[5]}; + + @media ${mediaQueries.sm} { + grid-template-columns: 1fr 1fr; + } +`; diff --git a/packages/cms/src/schemas/documents/pages/about.ts b/packages/cms/src/schemas/documents/pages/about.ts index af73b947dd..ccce92f048 100644 --- a/packages/cms/src/schemas/documents/pages/about.ts +++ b/packages/cms/src/schemas/documents/pages/about.ts @@ -12,10 +12,22 @@ export const about = defineType({ title: 'Titel', validation: localeStringValidation((rule) => rule.required()), }), + defineField({ + name: 'intro', + type: 'localeBlock', + title: 'Introductie (linkerkolom)', + validation: localeValidation((rule) => rule.required()), + }), + defineField({ + name: 'timelineImage', + type: 'localeImage', + title: 'Afbeelding tijdslijn', + validation: localeValidation((rule) => rule.required()), + }), defineField({ name: 'description', type: 'localeBlock', - title: 'Beschrijving', + title: 'Beschrijving (rechterkolom)', validation: localeValidation((rule) => rule.required()), }), ], diff --git a/packages/cms/src/schemas/index.ts b/packages/cms/src/schemas/index.ts index 1c42b7f2f7..3cff87000c 100644 --- a/packages/cms/src/schemas/index.ts +++ b/packages/cms/src/schemas/index.ts @@ -40,11 +40,12 @@ import { block } from './locale/block'; import { richContentBlock } from './locale/rich-content-block'; import { string } from './locale/string'; import { text } from './locale/text'; +import { image } from './locale/image'; import { inlineBlock } from './objects/inline-block'; import { inlineCollapsible } from './objects/inline-collapsible'; import { link } from './objects/link'; -const localeSpecificSchemas = [block, richContentBlock, string, text]; +const localeSpecificSchemas = [block, richContentBlock, string, text, image]; const richContentSchemas = [inlineBlock, inlineCollapsible]; const documentSchemas = [ advice, diff --git a/packages/cms/src/schemas/locale/image.ts b/packages/cms/src/schemas/locale/image.ts new file mode 100644 index 0000000000..96d92a0c7a --- /dev/null +++ b/packages/cms/src/schemas/locale/image.ts @@ -0,0 +1,39 @@ +import { defineField, defineType } from 'sanity'; +import { supportedLanguages } from '../../studio/i18n'; +import { BsCardImage } from 'react-icons/bs'; + +export const image = defineType({ + name: 'localeImage', + type: 'object', + title: 'Locale Image Content', + fields: supportedLanguages.map(({ title, id }) => + defineField({ + title, + name: id, + type: 'image', + icon: BsCardImage, + initialValue: { + isFullWidth: true, + }, + fields: [ + defineField({ + name: 'alt', + title: 'Alternatieve tekst (toegankelijkheid)', + type: 'string', + validation: (rule) => rule.required().error('Alt text is verplicht'), + }), + defineField({ + name: 'isFullWidth', + title: 'Afbeelding breed weergeven?', + type: 'boolean', + initialValue: false, + }), + defineField({ + name: 'caption', + title: 'Onderschrift', + type: 'text', + }), + ], + }) + ), +});