UNPKG

@atlaskit/logo

Version:

A logo is a visual representation of a brand or app. It can be a word, an image, or a combination of both.

147 lines (138 loc) 6.99 kB
/* logo-wrapper.tsx generated by @compiled/babel-plugin v3.0.2 */ /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ "use strict"; var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports.LogoWrapper = LogoWrapper; require("./logo-wrapper.compiled.css"); var React = _interopRequireWildcard(require("react")); var _runtime = require("@compiled/react/runtime"); var _fg = require("@atlaskit/platform-feature-flags/fg"); var _useThemeObserver2 = require("@atlaskit/tokens/use-theme-observer"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } var styles = { root: "_1e0c1o8l _vwz4idpf", TEMP_assets: "_9aea1fkg" }; // These styles set the `color` property so that the child SVG can inherit the correct text color using "currentColor" var logoTextColorMap = { light: "_syazqlpt", dark: "_syazz6c6" }; var sizeMap = { xxsmall: "_4t3i7vkz", xsmall: "_4t3igktf", small: "_4t3i1tcg", medium: "_4t3izwfg", large: "_4t3i1ylp", xlarge: "_4t3ickbl" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var textLightAppearanceMap = { brand: "_1wyci7uo", neutral: "_1wyc1e01", inverse: "_1wycu67f", legacy: "_1wycu67f" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var textDarkAppearanceMap = { brand: "_1wyci7uo", neutral: "_1wyc1gvk", inverse: "_1wyc5a6q", legacy: "_1wycu67f" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var cloudLightAppearanceMap = { brand: "_1b3i18uv _9aea18uv", neutral: "_1b3i1e01 _9aea1fkg", inverse: "_1b3i5a6q _9aeau67f", legacy: "_1b3iu67f _9aeadoyu" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var cloudDarkAppearanceMap = { brand: "_1b3i18uv _9aea18uv", neutral: "_1b3i1gvk _9aea8hz0", inverse: "_1b3iu67f _9aea5a6q", legacy: "_1b3iu67f _9aeadoyu" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var dataCenterLightAppearanceMap = { brand: "_1b3idoyu _9aeau67f _3wu01fkg", neutral: "_1b3i1e01 _9aea1fkg _3wu01e01", inverse: "_1b3iu67f _9aeaqlpt _3wu0u67f", legacy: "_1b3idoyu _9aeau67f _3wu01fkg" }; /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */ var dataCenterDarkAppearanceMap = { brand: "_1b3idoyu _9aeaqlpt _3wu08hz0", neutral: "_1b3i1gvk _9aea8hz0 _3wu01gvk", inverse: "_1b3i1501 _9aeau67f _3wu01501", legacy: "_1b3idoyu _9aeaqlpt _3wu08hz0" }; var rovoDarkAppearanceMap = { brand: "_1703lrxy _1evoh727 _epb51yy8 _1osdxeun", neutral: "_17031gvk _1evo1gvk _epb51gvk _1osd1gvk", inverse: "_1703qlpt _1evoqlpt _epb5qlpt _1osdqlpt", legacy: "_1703doyu _1evodoyu _epb5doyu _1osddoyu" }; var rovoLightAppearanceMap = { brand: "_170318uv _1evo18uv _epb518uv _1osd18uv", neutral: "_17031e01 _1evo1e01 _epb51e01 _1osd1e01", inverse: "_1703u67f _1evou67f _epb5u67f _1osdu67f", legacy: "_1703doyu _1evodoyu _epb5doyu _1osddoyu" }; /* eslint-enable @atlaskit/ui-styling-standard/no-imported-style-values */ /* eslint-enable @atlaskit/ui-styling-standard/no-unsafe-values */ function LogoWrapper(_ref) { var _ref$appearance = _ref.appearance, appearance = _ref$appearance === void 0 ? 'brand' : _ref$appearance, _ref$size = _ref.size, size = _ref$size === void 0 ? 'small' : _ref$size, svg = _ref.svg, customThemeSvg = _ref.customThemeSvg, label = _ref.label, userDefinedTestId = _ref.testId, customIconColor = _ref.iconColor, customTextColor = _ref.textColor, _ref$isAssets = _ref.isAssets, isAssets = _ref$isAssets === void 0 ? false : _ref$isAssets, _ref$type = _ref.type, type = _ref$type === void 0 ? 'tile' : _ref$type; var _useThemeObserver = (0, _useThemeObserver2.useThemeObserver)(), colorMode = _useThemeObserver.colorMode; var testId = userDefinedTestId && "".concat(userDefinedTestId, "--wrapper"); var isCustomThemed = customThemeSvg && (customIconColor || customTextColor); return /*#__PURE__*/React.createElement("span", { style: { // Nav v3 passes in "inherit" incorrectly for iconColor, so we fall back to textColor when this happens. // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values '--themed-icon-color': customIconColor === 'inherit' ? customTextColor : customIconColor, // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values '--themed-text-color': customTextColor || 'inherit' }, "data-testid": testId // If the label is provided an empty string, we want to remove the element from the accessibility tree. , "aria-label": label ? label : undefined, role: label ? 'img' : undefined, "aria-hidden": label === '' ? true : undefined // We are using dangerouslySetInnerHTML here to tell React not to track changes to the SVG elements. // This is because the SVG elements are static and will not change, so we get a little performance benefit by // bypassing React. , dangerouslySetInnerHTML: { __html: isCustomThemed ? customThemeSvg : svg }, className: (0, _runtime.ax)([styles.root, // Setting the color so that the SVG can inherit the correct text color using "currentColor" logoTextColorMap[colorMode !== null && colorMode !== void 0 ? colorMode : 'light'], sizeMap[size], colorMode === 'dark' ? textDarkAppearanceMap[appearance] : textLightAppearanceMap[appearance], colorMode === 'dark' ? dataCenterDarkAppearanceMap[appearance] : dataCenterLightAppearanceMap[appearance], type === 'rovo' ? colorMode === 'dark' ? rovoDarkAppearanceMap[appearance] : rovoLightAppearanceMap[appearance] : colorMode === 'dark' ? cloudDarkAppearanceMap[appearance] : cloudLightAppearanceMap[appearance], isAssets && appearance === 'brand' && ((0, _fg.fg)('assets-platform-branding') || (0, _fg.fg)('assets-platform-branding-v2')) && styles.TEMP_assets]) }); }