How to use the classnames.apply function in classnames

To help you get started, we’ve selected a few classnames 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 kidunot89 / wp-graphql-composer / dist / menu / menu.js View on Github external
}, rest), !isEmpty(items) && map(items, function (_ref2) {
    var id = _ref2.id,
        menuItemId = _ref2.menuItemId,
        cssClasses = _ref2.cssClasses,
        r = _objectWithoutProperties(_ref2, ["id", "menuItemId", "cssClasses"]);

    var itemClassName = classNames.apply(void 0, [styles.item].concat(_toConsumableArray(cssClasses), ["menu-item-".concat(menuItemId)]));
    return React.createElement("li", {
      id: "menu-item-".concat(menuItemId),
      className: itemClassName,
      key: id
    }, React.createElement(MenuItem, Object.assign({
      id: id
    }, _objectSpread({}, r, {
      SubMenu: SubMenu,
      MenuItem: MenuItem
    }))));
  }));
};
github salesforce-ux / design-system / app_modules / ui / util / component / index.js View on Github external
getClassName() {
    let args = Array.prototype.slice.call(arguments);
    args = args.concat(this.props.className);
    return classNames.apply(null, args);
  },
github kidunot89 / wp-graphql-composer / dist / menu / sub-menu.js View on Github external
}, rest), map(items, function (_ref) {
        var id = _ref.id,
            menuItemId = _ref.menuItemId,
            cssClasses = _ref.cssClasses,
            r = _objectWithoutProperties(_ref, ["id", "menuItemId", "cssClasses"]);

        var itemClassName = classNames.apply(void 0, [baseStyles.item, styles.item].concat(_toConsumableArray(cssClasses), ["menu-item-".concat(menuItemId)]));
        return React.createElement("li", {
          id: "menu-item-".concat(menuItemId),
          className: itemClassName,
          key: id
        }, React.createElement(MenuItem, Object.assign({
          id: id
        }, _objectSpread({}, r, {
          MenuItem: MenuItem,
          SubMenu: SubMenu
        }))));
      })));
    }
github Automattic / wp-calypso / client / my-sites / stats / stats-summary-chart / index.jsx View on Github external
render: function() {
		var classes,
			isLoading = this.props.dataList.isLoading();

		classes = [
			'stats-module',
			'is-summary-chart',
			{
				'is-loading': this.props.dataList.isLoading()
			}
		];

		return (
			
				
				
				{ this.chartTabs() }
			
		);
	}
} );
github commaai / cabana / src / utils / css.js View on Github external
export default function () {
  const styles = [];
  const classes = [];

  [].forEach.call(arguments, (it) => {
    if (it && it._definition && it._name) styles.push(it);
    else classes.push(it);
  });

  return classNames.apply(null, [...classes, css(styles)]);
}

classnames

A simple utility for conditionally joining classNames together

MIT
Latest version published 11 months ago

Package Health Score

88 / 100
Full package analysis