UNPKG

e-lado

Version:

[![CircleCI](https://circleci.com/gh/sharetribe/sharetribe/tree/master.svg?style=svg)](https://circleci.com/gh/sharetribe/sharetribe/tree/master) [![Dependency Status](https://gemnasium.com/sharetribe/sharetribe.png)](https://gemnasium.com/sharetribe/shar

53 lines (45 loc) 1.3 kB
import r, { div, strong, pre } from 'r-dom'; import { Component } from 'react'; import css from './ColorsAndTypography.css'; const defaultRailsContext = { i18nLocale: 'en', i18nDefaultLocale: 'en', location: '/', pathname: '/', marketplaceId: 1, marketplace_color1: '#64A', loggedInUsername: 'foo', }; const withProps = function withProps(component, props, children) { return div([ r(component, props, children), r.strong({ style: { marginTop: '2em', display: 'block' } }, 'Props:'), r.pre({ style: { marginTop: '1em', background: 'lightGrey', padding: '1em', display: 'inline-block', } }, JSON.stringify(props, null, ' ')), ]); }; const storify = (ComposedComponent, containerStyle) => ( class EnhancedComponent extends Component { render() { return div(null, [ div({ key: 'componentWrapper' }, [ div(containerStyle, ComposedComponent), ]), strong({ className: css.propsTitle, key: 'proprsTitle' }, 'Props:'), pre({ className: css.propsWrapper, key: 'propsWrapper', }, JSON.stringify({ props: ComposedComponent.props }, null, ' ')), ]); } } ); export default withProps; export { storify, defaultRailsContext };