File size: 1,416 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import type { CellPlugin } from '@react-page/editor';
import dynamic from 'next/dynamic';
import React from 'react';
import type { Field } from '../components/ContactFormExample';
// lazy load to keep initial bundle small
const ContactFormExample = dynamic(
() => import('../components/ContactFormExample')
);
const contactForm: CellPlugin<{
fields: Field[];
recipientId: string;
}> = {
Renderer: ({ data }) => (
<ContactFormExample fields={data.fields} recipientId={data.recipientId} />
),
id: 'contact-form',
title: 'Contact form',
description: 'A simple, configurable contactform',
version: 1,
controls: {
type: 'autoform',
columnCount: 1,
schema: {
properties: {
recipientId: {
type: 'string',
enum: ['recipient-1', 'recipient-2', 'recipient-3'],
},
fields: {
type: 'array',
items: {
type: 'object',
properties: {
label: {
type: 'string',
},
type: {
type: 'string',
enum: ['text', 'number'],
},
name: {
type: 'string',
},
required: {
type: 'boolean',
},
},
},
},
},
required: ['fields', 'recipientId'],
},
},
};
export default contactForm;
|