UNPKG

@atlaskit/lozenge

Version:

A lozenge is a visual indicator used to highlight an item's status for quick recognition.

29 lines (27 loc) 1.02 kB
// Map legacy appearance to new color values var legacyAppearanceMap = { default: 'neutral', removed: 'danger', inprogress: 'information', new: 'discovery', moved: 'warning' }; // Resolve the lozenge color based on the appearance export var resolveLozengeColor = function resolveLozengeColor() { var _legacyAppearanceMap$; var appearance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'neutral'; if (appearance.startsWith('accent-')) { return appearance; } return (_legacyAppearanceMap$ = legacyAppearanceMap[appearance]) !== null && _legacyAppearanceMap$ !== void 0 ? _legacyAppearanceMap$ : appearance; }; // extract the category and key from the resolved color export var getThemeStyles = function getThemeStyles(resolvedColor) { var isAccent = resolvedColor.startsWith('accent-'); var category = isAccent ? 'accent' : 'semantic'; var key = isAccent ? resolvedColor.replace('accent-', '') : resolvedColor; return { category: category, key: key }; };