Download react-page/docs/examples/plugins/customLayoutPlugin.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/customLayoutPlugin.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/customLayoutPlugin.tsx
-
curl -L -o customLayoutPlugin.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-page/docs/examples/plugins/customLayoutPlugin.tsx
1.05 kB
| import type { CellPlugin } from '@react-page/editor'; | |
| import React from 'react'; | |
| import { defaultSlate, customizedSlate } from './slate'; | |
| const customLayoutPlugin: CellPlugin<{ | |
| backgroundColor: string; | |
| }> = { | |
| Renderer: ({ children, data }) => ( | |
| <div | |
| style={{ | |
| border: '1px solid black', | |
| backgroundColor: data.backgroundColor, | |
| }} | |
| > | |
| {children} | |
| </div> | |
| ), | |
| createInitialChildren: () => { | |
| return [ | |
| [ | |
| { | |
| plugin: defaultSlate, | |
| }, | |
| { | |
| plugin: defaultSlate, | |
| }, | |
| ], | |
| [ | |
| { | |
| plugin: customizedSlate, | |
| }, | |
| { | |
| plugin: customizedSlate, | |
| }, | |
| ], | |
| ]; | |
| }, | |
| id: 'custom-layout-plugin', | |
| title: 'Custom layout plugin', | |
| description: 'Some custom layout plugin', | |
| version: 1, | |
| controls: { | |
| type: 'autoform', | |
| schema: { | |
| required: ['backgroundColor'], | |
| properties: { | |
| backgroundColor: { type: 'string' }, | |
| }, | |
| }, | |
| }, | |
| }; | |
| export default customLayoutPlugin; | |