import * as React from 'react' ; import PropTypes from 'prop-types' ; import { Record , useEditContext , useResourceDefinition } from 'ra-core' ; import { ShowButton } from '../button' ; import TopToolbar from '../layout/TopToolbar' ; example export const EditActions = ( { className , ... rest } ) => { const { basePath , record } = useEditContext ( rest ) ; const { hasShow } = useResourceDefinition ( rest ) ; return ( < TopToolbar className = { className } { ... sanitizeRestProps ( rest ) } > { hasShow && < ShowButton basePath = { basePath } record = { record } / > } < /TopToolbar>); } ; const sanitizeRestProps = ( { basePath = null , hasCreate = null , hasEdit = null , hasShow = null , hasList = null , ... rest } ) => rest ; export interface EditActionsProps { basePath ? : string ; className ? : string ; data ? : Record ; hasCreate ? : boolean ; hasEdit ? : boolean ; hasList ? : boolean ; hasShow ? : boolean ; resource ? : string ; } EditActions . propTypes = { basePath : PropTypes . string , className : PropTypes . string , data : PropTypes . object , hasCreate : PropTypes . bool , hasEdit : PropTypes . bool , hasShow : PropTypes . bool , hasList : PropTypes . bool , resource : PropTypes . string , } ;