@atlaskit/tag
Version:
A tag labels UI objects for quick recognition and navigation.
50 lines • 1.66 kB
JavaScript
/* swatch-before.tsx generated by @compiled/babel-plugin v3.0.2 */
import _extends from "@babel/runtime/helpers/extends";
import "./swatch-before.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
var tagSwatchBeforeStyles = {
swatch: "_2rkolb4i _1bsboqnp _4t3ioqnp _1o9zidpf"
};
var tagSwatchBeforeColorStyles = {
gray: "_bfhk18j9",
blue: "_bfhk115i",
green: "_bfhk1rsu",
red: "_bfhkkrt9",
yellow: "_bfhk8y3s",
purple: "_bfhk18ah",
lime: "_bfhkbq5w",
magenta: "_bfhk1mi6",
orange: "_bfhk1kkj",
teal: "_bfhktdv8"
};
/**
* Leading 12×12px swatch for TagNew / TagDropdownTrigger (before elemBefore).
*/
export default function SwatchBefore(_ref) {
var colorKey = _ref.colorKey,
swatchBefore = _ref.swatchBefore,
swatchBeforeLabel = _ref.swatchBeforeLabel,
swatchBeforeRole = _ref.swatchBeforeRole;
if (swatchBefore === undefined || swatchBefore === false) {
return null;
}
if (swatchBefore === true) {
return /*#__PURE__*/React.createElement("span", _extends({}, swatchBeforeLabel && swatchBeforeRole ? {
'aria-label': swatchBeforeLabel,
role: swatchBeforeRole
} : {}, {
className: ax([tagSwatchBeforeStyles.swatch, tagSwatchBeforeColorStyles[colorKey]])
}));
}
return /*#__PURE__*/React.createElement("span", _extends({}, swatchBeforeLabel && swatchBeforeRole ? {
'aria-label': swatchBeforeLabel,
role: swatchBeforeRole
} : {}, {
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
style: {
backgroundColor: swatchBefore
},
className: ax([tagSwatchBeforeStyles.swatch])
}));
}