How to use the prop-types.element function in prop-types

To help you get started, we’ve selected a few prop-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wp-calypso / client / layout / jetpack-dashboard.jsx View on Github external
*/
import AsyncLoad from 'components/async-load';
import GlobalNotices from 'components/global-notices';
import JetpackDashboardMasterbar from 'layout/masterbar/jetpack-dashboard';
import notices from 'notices';
import { getSelectedSiteId, getSectionName } from 'state/ui/selectors';
import DocumentHead from 'components/data/document-head';

/**
 * Style dependencies
 */
import './jetpack-dashboard.scss';

class JetpackDashboardLayout extends Component {
	static propTypes = {
		primary: PropTypes.element,
		secondary: PropTypes.element,
		// connected props
		sectionName: PropTypes.string,
	};

	render() {
		const sectionClass = classnames( 'layout', `is-section-${ this.props.sectionName }` );

		return (
			<div>
				

				

				<div id="content">
					</div></div>
github mongodb-js / connect-backbone-to-react / lib / backbone-provider.js View on Github external
class BackboneProvider extends Component {
  getChildContext() {
    return {
      models: this.props.models,
    };
  }

  render() {
    return Children.only(this.props.children);
  }
}

BackboneProvider.propTypes = {
  models: PropTypes.object,
  children: PropTypes.element.isRequired,
};
BackboneProvider.childContextTypes = {
  models: PropTypes.object,
};
BackboneProvider.displayName = 'BackboneProvider';

module.exports = BackboneProvider;
github TerriaJS / terriajs / lib / ReactViews / DataCatalog / CatalogGroup.jsx View on Github external
);
}

CatalogGroup.propTypes = {
  text: PropTypes.string,
  title: PropTypes.string,
  topLevel: PropTypes.bool,
  open: PropTypes.bool,
  loading: PropTypes.bool,
  emptyMessage: PropTypes.string,
  onClick: PropTypes.func,
  children: PropTypes.oneOfType([
    PropTypes.element,
    PropTypes.arrayOf(PropTypes.element)
  ]),
  selected: PropTypes.bool,
  removable: PropTypes.bool,
  removeUserAddedData: PropTypes.func,
  t: PropTypes.func
};

export default CatalogGroup;
github polonel / trudesk / src / client / components / PDropdown / index.jsx View on Github external
)}
      
    )
  }
}

PDropDown.propTypes = {
  id: PropTypes.string.isRequired,
  title: PropTypes.string.isRequired,
  titleHref: PropTypes.string,
  leftArrow: PropTypes.bool,
  override: PropTypes.bool,
  topOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  leftOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  rightComponent: PropTypes.element,
  footerComponent: PropTypes.element,
  minHeight: PropTypes.number,
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
}

PDropDown.defaultProps = {
  leftArrow: false,
  override: false,
  topOffset: '0',
  leftOffset: '0',
  minHeight: 0
}

export default PDropDown
github notadd / next / src / layout / Responsive.js View on Github external
component = medium || (large || small);
            break;
        case 'lg':
        case 'xl':
            component = large || (medium || small);
            break;
        default:
            throw new Error(`Unknown width ${width}`);
    }
    return React.cloneElement(component, rest);
};

Responsive.propTypes = {
    small: PropTypes.element,
    medium: PropTypes.element,
    large: PropTypes.element,
    width: PropTypes.string,
};

export default withWidth()(Responsive);
github instructure / instructure-ui / packages / ui-core / src / components / Overlay / index.js View on Github external
*/
    insertAt: PropTypes.oneOf(['bottom', 'top']),

    label: PropTypes.string,
    /**
     * Callback fired when the `` is requesting to be closed
     */
    onDismiss: PropTypes.func,
    /**
     * An element or a function returning an element to focus by default
     */
    defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
    /**
     * An element or a function returning an element to apply `aria-hidden` to
     */
    applicationElement: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.func]),
    /**
     * An element or a function returning an element that wraps the content of the ``
     */
    contentElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),

    shouldContainFocus: PropTypes.bool,
    shouldReturnFocus: PropTypes.bool,
    shouldCloseOnDocumentClick: PropTypes.bool,
    shouldCloseOnEscape: PropTypes.bool,
    /**
     * The type of `` to use for animating in/out
     */
    transition: Transition.propTypes.type,
    /**
     * Show the component; triggers the enter or exit animation
     */
github pluralsight / design-system / packages / layout / src / react / page-heading-layout.js View on Github external
<div>
      <div>
        {props.heading}
        {Array.isArray(props.actions) &amp;&amp; props.actions.length &gt; 0 &amp;&amp; (
          <div>{props.actions}</div>
        )}
      </div>
      {props.children}
    </div>
  )
}
PageHeadingLayout.displayName = 'PageHeadingLayout'
PageHeadingLayout.propTypes = {
  actions: PropTypes.arrayOf(PropTypes.element),
  children: PropTypes.any,
  heading: PropTypes.element.isRequired
}
PageHeadingLayout.defaultProps = {
  actions: []
}

export default PageHeadingLayout
github processing / p5.js-web-editor / client / modules / IDE / pages / IDEView.jsx View on Github external
closeNewFolderModal: PropTypes.func.isRequired,
  createFolder: PropTypes.func.isRequired,
  createFile: PropTypes.func.isRequired,
  closeShareModal: PropTypes.func.isRequired,
  showEditorOptions: PropTypes.func.isRequired,
  closeEditorOptions: PropTypes.func.isRequired,
  showKeyboardShortcutModal: PropTypes.func.isRequired,
  closeKeyboardShortcutModal: PropTypes.func.isRequired,
  toast: PropTypes.shape({
    isVisible: PropTypes.bool.isRequired
  }).isRequired,
  autosaveProject: PropTypes.func.isRequired,
  router: PropTypes.shape({
    setRouteLeaveHook: PropTypes.func
  }).isRequired,
  route: PropTypes.oneOfType([PropTypes.object, PropTypes.element]).isRequired,
  setUnsavedChanges: PropTypes.func.isRequired,
  setTheme: PropTypes.func.isRequired,
  endSketchRefresh: PropTypes.func.isRequired,
  startRefreshSketch: PropTypes.func.isRequired,
  setBlobUrl: PropTypes.func.isRequired,
  setPreviousPath: PropTypes.func.isRequired,
  console: PropTypes.arrayOf(PropTypes.shape({
    method: PropTypes.string.isRequired,
    args: PropTypes.arrayOf(PropTypes.string)
  })).isRequired,
  clearConsole: PropTypes.func.isRequired,
  showErrorModal: PropTypes.func.isRequired,
  hideErrorModal: PropTypes.func.isRequired,
  clearPersistedState: PropTypes.func.isRequired,
  persistState: PropTypes.func.isRequired,
  hideHelpModal: PropTypes.func.isRequired,