import { type RenderElementProps, useSelected } from 'slate-react' import { LayoutArea, LayoutContainer } from './layouts.tsx' import { ComponentBlocksElement, ComponentInlineProp } from './component-blocks/index.tsx' import { LinkElement } from './link.tsx' import { HeadingElement } from './heading.tsx' import { BlockquoteElement } from './blockquote.tsx' import { RelationshipElement } from './relationship.tsx' import { tokenSchema } from '@keystar/ui/style' // some of the renderers read properties of the element // and TS doesn't understand the type narrowing when doing a spread for some reason // so that's why things aren't being spread in some cases export const renderElement = (props: RenderElementProps) => { switch (props.element.type) { case 'layout': return ( ) case 'layout-area': return case 'code': return case 'component-block': { return ( ) } case 'component-inline-prop': case 'component-block-prop': return case 'heading': return ( ) case 'link': return ( ) case 'ordered-list': return
    {props.children}
case 'unordered-list': return
    {props.children}
case 'list-item': return
  • {props.children}
  • case 'list-item-content': return {props.children} case 'blockquote': return case 'relationship': return ( ) case 'divider': return default: return (

    {props.children}

    ) } } /* Block Elements */ const CodeElement = ({ attributes, children }: RenderElementProps) => { return (
          {children}
        
    ) } function DividerElement({ attributes, children }: RenderElementProps) { const selected = useSelected() return (

    {children}
    ) }