Skip to content

Text/textbox #2619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add open forms container
  • Loading branch information
Marwa committed Nov 13, 2024
commit 7ed401e7782d7a702e76830fee7478a5fb8dba06
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { clsx } from 'clsx';
import React, { HTMLAttributes, PropsWithChildren } from 'react';
import './OpenFormsContainer.scss';

export interface OpenFormsContainerProps extends HTMLAttributes<HTMLDivElement> {}

export const OpenFormsContainer = ({
children,
className,
...restProps
}: PropsWithChildren<OpenFormsContainerProps>) => {
return (
<div className={clsx('utrecht-open-forms-container', className)} {...restProps}>
{children}
</div>
);
};
13 changes: 11 additions & 2 deletions packages/storybook-react/src/stories/open-forms/StoryUtil.tsx
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import merge from 'lodash.merge';
import React, { PropsWithChildren, useEffect, useState } from 'react';
import { Form, Formio, Templates } from 'react-formio';
import '@open-formulieren/sdk/styles.css';
import { OpenFormsContainer } from './OpenFormsContainer';

export type FormConfiguration = { type: string; components: { type: string; key: string; label: string }[] };

@@ -69,9 +70,17 @@ export const SingleFormioComponent = ({
extraComponentProperties = {},
}: SingleFormioComponentProps) => {
const component = merge({ type, key, label }, extraComponentProperties);
return <RenderFormioForm form={{ type: 'form', components: [component] }} />;
return (
<OpenFormsContainer>
<RenderFormioForm form={{ type: 'form', components: [component] }} />
</OpenFormsContainer>
);
};

export const MultipleFormioComponents = ({ components }: MultipleFormioComponentsProps) => {
return <RenderFormioForm form={{ type: 'form', components: components }} />;
return (
<OpenFormsContainer>
<RenderFormioForm form={{ type: 'form', components: components }} />
</OpenFormsContainer>
);
};