Download react-page/docs/examples/plugins/contactForm.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/contactForm.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/contactForm.tsx
-
curl -L -o contactForm.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/contactForm.tsx
1.42 kB
| 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; | |