Skip to content

Commit

Permalink
✅ [open-formulieren/open-forms#2173] Map background configuration in …
Browse files Browse the repository at this point in the history
…storybook
  • Loading branch information
robinmolen committed Nov 21, 2024
1 parent 02b5157 commit 1c1b224
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .storybook/decorators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DEFAULT_COMPONENT_TREE,
DEFAULT_DOCUMENT_TYPES,
DEFAULT_FILE_TYPES,
DEFAULT_LEAFLET_BACKGROUNDS,
DEFAULT_PREFILL_ATTRIBUTES,
DEFAULT_PREFILL_PLUGINS,
DEFAULT_REGISTRATION_ATTRIBUTES,
Expand Down Expand Up @@ -74,6 +75,7 @@ export const BuilderContextDecorator: Decorator = (Story, context) => {
uniquifyKey: key => key,
supportedLanguageCodes: supportedLanguageCodes,
richTextColors: DEFAULT_COLORS,
getLeafletMapBackgrounds: async () => DEFAULT_LEAFLET_BACKGROUNDS,
theme,
getFormComponents: () => context?.args?.componentTree || defaultComponentTree,
getValidatorPlugins: async () => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ComponentConfiguration.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
DEFAULT_COLORS,
DEFAULT_DOCUMENT_TYPES,
DEFAULT_FILE_TYPES,
DEFAULT_LEAFLET_BACKGROUNDS,
} from '@/tests/sharedUtils';
import {AnyComponentSchema} from '@/types';

Expand Down Expand Up @@ -109,6 +110,7 @@ const Template: StoryFn<TemplateArgs> = ({
getPrefillPlugins={async () => prefillPlugins}
getPrefillAttributes={async (plugin: string) => prefillAttributes[plugin]}
getFileTypes={async () => fileTypes}
getLeafletMapBackgrounds={async () => DEFAULT_LEAFLET_BACKGROUNDS}
serverUploadLimit="50MB"
getDocumentTypes={async () => DEFAULT_DOCUMENT_TYPES}
getConfidentialityLevels={async () => CONFIDENTIALITY_LEVELS}
Expand Down
15 changes: 14 additions & 1 deletion src/tests/sharedUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This module contains shared utilities and constants between Jest and Storybook.
import type {DocumentTypeOption, SelectOption} from '@/context';
import type {DocumentTypeOption, LeafletMapOption, SelectOption} from '@/context';
import {ColorOption} from '@/registry/content/rich-text';
import {AnyComponentSchema} from '@/types';

Expand Down Expand Up @@ -235,6 +235,19 @@ export const DEFAULT_COLORS: ColorOption[] = [
},
];

export const DEFAULT_LEAFLET_BACKGROUNDS: LeafletMapOption[] = [
{
identifier: 'default',
label: 'Default',
url: 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/standaard/EPSG:28992/{z}/{x}/{y}.png',
},
{
identifier: 'infrared',
label: 'Infrared',
url: 'https://service.pdok.nl/hwh/luchtfotocir/wmts/v1_0/2016_ortho25IR/EPSG:28992/{z}/{x}/{y}.png',
},
];

export function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}

0 comments on commit 1c1b224

Please sign in to comment.