UNPKG

stitch-ui

Version:

41 lines (36 loc) 1.02 kB
import React from "react"; // eslint-disable-line no-unused-vars import PropTypes from "prop-types"; import { FieldRule } from "../mongodb_rule"; import { MiniLabel } from "../../../core"; export default function ShadowDisplay({ shadow, name }) { if (!shadow) { return null; } return ( <div className="permission-editor-input-container"> <div> <MiniLabel htmlFor={name}> {name} </MiniLabel> <div className="mongo-schema-shadow-warning"> {"Permission is already set by "} {shadow.dottedFullPath !== null ? <span> field{" "} <span className="mongo-schema-mono"> {" "}{shadow.dottedFullPath} </span> </span> : "top level document"} </div> </div> </div> ); } ShadowDisplay.propTypes = { shadow: PropTypes.instanceOf(FieldRule), name: PropTypes.string.isRequired }; ShadowDisplay.defaultProps = { shadow: null };