Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 1x 5x 17x | import cx from 'classnames' export const MAX_LABEL_LENGTH = 100 export const TRANSPARENT = 'transparent' export const SIZES = { LARGE: 'large', MEDIUM: 'medium', SMALL: 'small' } export const TYPES = { SUCCESS: 'success', ERROR: 'error', INFO: 'info', ALERT: 'alert', NEW: 'new', NEUTRAL: 'neutral', PRIMARY: 'primary', SECONDARY: 'secondary' } export const DESIGNS = { SOLID: 'solid', SOFT: 'soft' } export const BASE_CLASS = `sui-AtomBadge` export const CLASS_ICON = `${BASE_CLASS}-icon` export const CLASS_ICON_RIGHT = `${CLASS_ICON}--iconRight` export const CLASS_TEXT = `${CLASS_ICON}-text` /** * Cuts off exceeded char limit * @param {string} label * @return {string} */ export const truncateText = function (label) { return label.length < MAX_LABEL_LENGTH ? label : label.substr(0, MAX_LABEL_LENGTH) } /** * @param {object} options * @param {string} options.size * @param {boolean} options.transparent * @param {object} options.iconRight * @param {string} options.type * @return {string} */ export const getClassNames = function ({design, iconRight, size, transparent: isTransparent, type, className}) { return cx( BASE_CLASS, `${BASE_CLASS}-size-${size}`, `${BASE_CLASS}-type-${type}`, `${BASE_CLASS}-design-${design}`, { [`${BASE_CLASS}--isTransparent`]: isTransparent }, className ) } /** * Small badges with a background can't have an icon * @param {Object} options * @param {Object} options.icon * @param {string} options.size * @param {boolean} options.transparent * @return {boolean} */ export const shouldRenderIcon = ({icon, size, transparent}) => Boolean(icon && (size !== SIZES.SMALL || transparent)) |