File size: 847 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 |
import type { CellPlugin } from '@react-page/editor';
import dynamic from 'next/dynamic';
import React from 'react';
// lazy load to keep initial bundle small
const CodeSnippet = dynamic(() => import('../components/CodeSnippet'));
const codeSnippet: CellPlugin<{
code: string;
language: string;
}> = {
Renderer: ({ data }) =>
data?.code ? (
<CodeSnippet language={data.language} code={data.code} />
) : null,
id: 'code-snippet',
title: 'Code snippet',
description: 'A code snippet',
version: 1,
controls: {
type: 'autoform',
schema: {
properties: {
language: {
type: 'string',
},
code: {
type: 'string',
uniforms: {
multiline: true,
},
},
},
required: ['code'],
},
},
};
export default codeSnippet;
|