How to use react-fela - 10 common examples

To help you get started, we’ve selected a few react-fela 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 olymp / olymp / src / _old / cms / views / sidebar / card.js View on Github external
);

const StyledCardContent = createComponent(() => ({
  padding: '8px',
  marginLeft: '60px',
}));

const StyledCardTitle = createComponent(
  () => ({
    width: '200px',
    ellipsis: true,
  }),
  'h6'
);

const StyledCardParagraph = createComponent(
  () => ({
    margin: 0,
    ellipsis: true,
    width: '200px',
    // whiteSpace: 'nowrap',
    display: '-webkit-box',
    WebkitBoxOrient: 'vertical',
    WebkitLineClamp: 3,
    lineHeight: '18px',
    maxHeight: '54px',
    fontSize: 'small',
  }),
  'p'
);

export default ({ name, description, image, ...rest }) =>
github robinweser / kilvin / modules / components / Box.js View on Github external
flexShrink: props.shrink || 0,
  flexBasis: props.basis || 'auto',
  flex: props.flex === true ? 1 : props.flex,
  justifyContent: props.justifyContent || props.center && 'center',
  alignItems: props.alignItems || props.center && 'center',
  alignContent: props.alignContent || 'flex-start',
  alignSelf: props.alignSelf || 'stretch',
  order: props.order,

  // shorthands
  display: (props.inline ? 'inline-' : '') + 'flex',
  flexWrap: props.wrap && 'wrap' || props.wrapReverse && 'wrap-reverse' || 'nowrap',
  flexDirection: (props.row ? 'row' : 'column') + (props.reverse ? '-reverse' : '')
})

export default createComponent(Box)
github olymp / olymp / external / ui / modal.es6 View on Github external
ReactModal2.getApplicationElement = () => document.getElementById('app');

// isOpen={isOpen} transitionSpeed={1000} on={ReactModal}
const ReactModal = ({ className, ...props }) => (
  
);

const getLogo = x => {
  if (typeof x === 'function') {
    return x();
  }
  return <img alt="logo" src="{x}">;
};

export const Modal = withTheme(
  ({
    isOpen,
    showLogo,
    leftButtons,
    rightButtons,
    className,
    subtitle,
    onClose,
    onCancel,
    okText,
    cancelText,
    onOk,
    title,
    loading,
    theme,
    noPortal,
github olymp / olymp / _ / _deprecated / auth / modal.es6 View on Github external
ReactModal2.getApplicationElement = () =&gt; document.getElementById('app');

// isOpen={isOpen} transitionSpeed={1000} on={ReactModal}
const ReactModal = ({ className, ...props }) =&gt; (
  
);

const getLogo = x =&gt; {
  if (typeof x === 'function') {
    return x();
  }
  return <img alt="logo" src="{x}">;
};

const Modal = withTheme(
  ({
    isOpen,
    showLogo,
    leftButtons,
    rightButtons,
    className,
    subtitle,
    onClose,
    onCancel,
    okText,
    cancelText,
    onOk,
    title,
    loading,
    theme,
    noPortal,
github robinweser / fela / packages / fela-enzyme / src / __tests__ / felaShallow.js View on Github external
describe('components withTheme', () =&gt; {
    const DivWithTheme = ({ theme }) =&gt; <div>{theme.color.grass}</div>
    DivWithTheme.propTypes = {
      theme: PropTypes.object,
    }

    const WithThemeDiv = withTheme(DivWithTheme)
    it('should capture snapshot', () =&gt; {
      const { wrapper, snapshot } = felaShallow(, {}, rootTheme)
      expect(snapshot(wrapper)).toMatchSnapshot()
    })
  })
github robinweser / fela / packages / babel-plugin-fela / src / __tests__ / __fixtures__ / createComponentMergeClassName.js View on Github external
const rule = ({ fontSize, padding }) => ({
  _className: 'foo bar',
  fontSize,
  color: 'red',
  '@media (min-height: 300px)': {
    backgroundColor: 'red',
    lineHeight: 2,
    ':hover': {
      color: 'black',
      paddingLeft: padding,
    },
  },
})

export default createComponent(rule)
github robinweser / fela / packages / fela-enzyme / src / __tests__ / felaShallow.js View on Github external
const applyTheme = (ComponentToWrap, ...themes) =&gt; {
  const ThemedComponent = props =&gt; (
    
      
    
  )

  ThemedComponent._isFelaComponent = true
  ThemedComponent.defaultProps = {
    theme: {},
  }
  ThemedComponent.propTypes = {
    theme: PropTypes.object,
  }

  const WithThemeHOC = withTheme(ThemedComponent)
  return WithThemeHOC
}
github olymp / olymp / packages / fela / skeletor / create-skeletor-component.ts View on Github external
render() {
      const { skeletorLoading, theme, renderer } = this.context;

      return createComponent(
        p =>
          styles({
            ...p,
            skeletor: skeletorLoading
              ? {
                  background: this.background,
                  overlay: this.overlay,
                  text: this.text,
                  isLoading: true,
                }
              : {
                  background: () => ({}),
                  overlay: () => ({}),
                  text: () => ({}),
                  isLoading: false,
                },
github olymp / olymp / packages / fela / with-style.es6 View on Github external
export default (styles, props = p =&gt; Object.keys(p), propName) =&gt; WrappedComponent =&gt; {
  if (!propName &amp;&amp; typeof props === 'string') {
    propName = props;
    props = null;
  }
  if (!propName) {
    propName = 'className';
  }
  return createComponent(
    typeof styles === 'function' ? styles : () =&gt; styles,
    ({ className, ...rest }) =&gt; {
      rest[propName] = className
      return (
        
      )
    },
    props
  );
};
github olymp / olymp / packages / fela / src / navbar / mega.js View on Github external
});
}, 'div', function (p) { return Object.keys(p); });
var Title = createComponent(function (_a) {
    var theme = _a.theme, inverse = _a.inverse;
    return ({
        display: 'block',
        fontWeight: 'bold',
        marginBottom: theme.space3,
        padding: theme.space0,
        color: inverse ? theme.light : theme.dark,
    });
}, function (p) {
    return (React.createElement("h4", null,
        React.createElement(Link, __assign({}, p))));
}, function (p) { return Object.keys(p); });
var PaddingLink = createComponent(function (_a) {
    var theme = _a.theme;
    return ({
        padding: theme.space1 + " " + theme.space0,
    });
}, function (p) { return React.createElement(Link, __assign({}, p)); }, function (p) { return Object.keys(p); });
var Item = createComponent(function (_a) {
    var theme = _a.theme;
    return ({
        onHover: {
            '> div': {
                display: 'block',
            },
        },
    });
}, 'div', function (p) { return Object.keys(p); });
var SubMenu = createComponent(function (_a) {