import * as React from 'react'; import { ReactElement } from 'react'; import { RaRecord } from '../../types'; import { useShowController, ShowControllerProps } from './useShowController'; import { ShowContextProvider } from './ShowContextProvider'; import { ResourceContextProvider } from '../../core'; /** * Call useShowController and put the value in a ShowContext * * Base class for components, without UI. * * Accepts any props accepted by useShowController: * - id: The record identifier * - resource: The resource * * @example // Custom show layout * * const PostShow = () => ( * * * * * ... * * * * Show instructions... * * *
* Post related links... *
*
* ); */ export const ShowBase = ({ children, ...props }: { children: ReactElement } & ShowControllerProps) => { const controllerProps = useShowController(props); const body = ( {children} ); return props.resource ? ( // support resource override via props {body} ) : ( body ); };