detach-compile-button-wrapper.js 589 B

1234567891011121314151617181920212223
  1. import { memo } from 'react'
  2. import PropTypes from 'prop-types'
  3. import { useLayoutContext } from '../../../shared/context/layout-context'
  4. import DetachCompileButton from './detach-compile-button'
  5. function DetachCompileButtonWrapper() {
  6. const { detachRole, detachIsLinked } = useLayoutContext(
  7. layoutContextPropTypes
  8. )
  9. if (detachRole !== 'detacher' || !detachIsLinked) {
  10. return null
  11. }
  12. return <DetachCompileButton />
  13. }
  14. const layoutContextPropTypes = {
  15. detachRole: PropTypes.string,
  16. detachIsLinked: PropTypes.bool,
  17. }
  18. export default memo(DetachCompileButtonWrapper)