How to use aphrodite - 10 common examples

To help you get started, we’ve selected a few aphrodite 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 Khan / wonder-blocks / config / jest / test-setup.js View on Github external
const {StyleSheetTestUtils} = require("aphrodite");
const Enzyme = require("enzyme");
const EnzymeAdapter = require("enzyme-adapter-react-16");

jest.spyOn(console, "error").mockImplementation((msg) => {
    throw new Error(`Unexpected call to console.error: ${msg}`);
});

StyleSheetTestUtils.suppressStyleInjection();

// Setup enzyme's react adapter
Enzyme.configure({adapter: new EnzymeAdapter()});

require("../../node_modules/jest-enzyme/lib/index.js");
github brave / browser-laptop / app / renderer / components / common / sortableTable.js View on Github external
styles.table__th__inner,
                    this.props.smallRow && styles.table__th__inner_smallRow,
                    this.props.headerStyles
                  )} data-l10n-id={heading} />
                  : heading
              }
            
          })}
        
      
      {this.generateTableBody()}
    
  }
}

const styles = StyleSheet.create({
  // By default the width and margin are not specified.
  // It can be specified by setting css to tableClassNames.
  // See 'styles.devices__devicesList' on syncTab.js for example.
  table: {
    boxSizing: 'border-box',
    cursor: 'default',
    borderSpacing: 0,

    // #10434: Enable border on the table by default
    borderCollapse: 'collapse'
  },

  // Setting 'fillAvailable' maximizes the width of the table.
  table_fillAvailable: {
    width: '-webkit-fill-available'
  },
github commaai / cabana / src / components / AddSignals.js View on Github external
let backgroundColor;
    if (this.state && this.state.highlightedSignal === signal.name) {
      // when signal highlighted,
      // darkened background and lightened text.

      const darkenedColors = shade(colors, -0.5);
      const lightenedColors = shade(colors, 0.9);
      colorRgbStr = `rgb(${lightenedColors.join(',')})`;
      backgroundColor = `rgba(${darkenedColors.join(',')},0.5)`;
    } else {
      const colorsCommaSep = colors.join(',');
      colorRgbStr = `rgb(${colorsCommaSep})`;
      backgroundColor = `rgba(${colorsCommaSep},0.2)`;
    }

    const style = StyleSheet.create({
      signal: { color: colorRgbStr, backgroundColor }
    }).signal;
    return style;
  }
github watson-developer-cloud / natural-language-understanding-nodejs / views / Table.jsx View on Github external
marginTop: '0rem',
      display: 'flex',
      alignItems: 'center',
      paddingRight: '1rem',
      ':before': {
        display: 'none',
      },
    },
    cell_header: {},
    inner: {
      display: 'block',
      width: '100%',
    },
  };

  const styles = StyleSheet.create(deepAssign(
    base,
    {
      // responsive to two column state
      table_two: {
        display: 'flex',
        flexDirection: 'column',
        [breakpoint(bp.SMALL)]: base.table,
      },
      row_two: {
        display: 'flex',
        flexDirection: 'column',
        [breakpoint(bp.SMALL)]: base.row,
      },
      row_header_two: {
        display: 'none',
        [breakpoint(bp.SMALL)]: base.row_header,
github guonanci / react-images-viewer / lib / components / Arrow.js View on Github external
function Arrow(_ref) {
  var direction = _ref.direction,
      icon = _ref.icon,
      onClick = _ref.onClick,
      size = _ref.size,
      theme = _ref.theme,
      props = _objectWithoutProperties(_ref, ['direction', 'icon', 'onClick', 'size', 'theme']);

  var classes = _noImportant.StyleSheet.create((0, _util.deepMerge)(defaultStyles, theme));

  return _react2.default.createElement(
    'button',
    _extends({
      type: 'button' // default: submit
      , className: (0, _noImportant.css)(classes.arrow, classes['arrow__direction__' + direction], size && classes['arrow__size__' + size]),
      onClick: onClick,
      onTouchEnd: onClick
    }, props),
    _react2.default.createElement(_Icon2.default, { fill: !!theme.arrow && theme.arrow.fill || _theme2.default.arrow.fill, type: icon })
  );
}
github koddr / react-goodshare-components / lib / providers / Facebook / components / button.js View on Github external
CONTAINER_FONT_COLOR = "rgb(255, 255, 255)";
          CONTAINER_FONT_COLOR_HOVER = "rgb(255, 255, 255)";
          CONTAINER_BORDER = "1px solid rgb(59, 89, 152)";
          SHARE_COUNTER_BORDER_LEFT = "1px solid rgba(255, 255, 255, 0.4)";
          break;
        default:
          CONTAINER_BACKGROUND = "rgb(59, 89, 152)";
          CONTAINER_BACKGROUND_HOVER = "rgb(59, 99, 162)";
          CONTAINER_FONT_COLOR = "rgb(255, 255, 255)";
          CONTAINER_FONT_COLOR_HOVER = "rgb(255, 255, 255)";
          CONTAINER_BORDER = "1px solid rgb(59, 89, 152)";
          SHARE_COUNTER_BORDER_LEFT = "1px solid rgba(255, 255, 255, 0.4)";
          break;
      }

      var Theme = _noImportant.StyleSheet.create({
        container: {
          background: CONTAINER_BACKGROUND,
          color: CONTAINER_FONT_COLOR,
          border: CONTAINER_BORDER,
          ":hover": {
            background: CONTAINER_BACKGROUND_HOVER,
            color: CONTAINER_FONT_COLOR_HOVER
          }
        },
        share_counter: {
          borderLeft: SHARE_COUNTER_BORDER_LEFT
        }
      });

      // Return element
      return React.createElement(
github tesseralis / polyhedra-viewer / src / setupTests.js View on Github external
// @flow
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { StyleSheetTestUtils } from 'aphrodite';

configure({ adapter: new Adapter() });
StyleSheetTestUtils.suppressStyleInjection();

jest.mock('x3dom.js');
github TrueCar / gluestick / packages / gluestick-plugin-aphrodite / src / server.js View on Github external
renderMethod: (root, styleTags) => {
    const { css, html } = StyleSheetServer.renderStatic(() => {
      return renderToString(root);
    });
    const head = [
      ...styleTags,
      <style data-aphrodite="">{`${css.content}`}</style>,
    ];
    const rehydrate = `window.renderedClassNames = ${JSON.stringify(
      css.renderedClassNames,
    )};`;
    const additionalScript = [
      // eslint-disable-next-line react/no-danger
github javascriptair / site / generate / renderComponentToFile.js View on Github external
function renderComponent(comp, destinations, callback = noop) {
  destinations = arrify(destinations)
  const {html, css} = StyleSheetServer.renderStatic(() => ReactDOMServer.renderToStaticMarkup(comp))
  const string = html.replace('/* aphrodite-content */', css.content)
  async.parallel(
    destinations.map(d => cb => writeFile(d, string, cb)),
    callback,
  )
}
github Ariel-Rodriguez / react-amp-template / src / StyleManager / Aphrodite.js View on Github external
static render(element, opts) {
    // eslint-disable-next-line global-require
    const { StyleSheetServer } = require('aphrodite')
    const { css, html } = StyleSheetServer.renderStatic(() => preactToString(element, null, opts))
    return {
      css: css.content,
      html,
    }
  }
}