UNPKG

@salesforce/design-system-react

Version:

Salesforce Lightning Design System for React

65 lines (52 loc) 3.38 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */ /* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */ // # Global Navigation Bar Button Component // ## Dependencies // ### React import React from 'react'; import PropTypes from 'prop-types'; // ### classNames import classNames from 'classnames'; // ### Button import Button from '../button'; // ## Constants import { GLOBAL_NAVIGATION_BAR_BUTTON } from '../../utilities/constants'; /** * A helper component that renders a Button as an item in the Global Navigation Bar. All props are passed onto `Button` except `active` and `dividerPosition`. */ var GlobalNavigationButton = function GlobalNavigationButton(_ref) { var _ref$className = _ref.className, className = _ref$className === void 0 ? 'slds-context-bar__label-action slds-text-body_regular' : _ref$className, _ref$style = _ref.style, style = _ref$style === void 0 ? { lineHeight: 'inherit' } : _ref$style, _ref$variant = _ref.variant, variant = _ref$variant === void 0 ? 'base' : _ref$variant, active = _ref.active, dividerPosition = _ref.dividerPosition, props = _objectWithoutProperties(_ref, ["className", "style", "variant", "active", "dividerPosition"]); return /*#__PURE__*/React.createElement("li", { className: classNames('slds-context-bar__item', _defineProperty({ 'slds-is-active': active }, "slds-context-bar__item_divider-".concat(dividerPosition), dividerPosition)) }, /*#__PURE__*/React.createElement(Button, _extends({ className: className, style: style, variant: variant }, props))); }; GlobalNavigationButton.displayName = GLOBAL_NAVIGATION_BAR_BUTTON; // ### Prop Types GlobalNavigationButton.propTypes = { /** * Whether the item is active or not. */ active: PropTypes.bool, /** * Determines position of separating bar. */ dividerPosition: PropTypes.oneOf(['left', 'right']) }; export default GlobalNavigationButton; //# sourceMappingURL=button.js.map