baseui
Version:
A React Component library implementing the Base design language
53 lines (50 loc) • 1.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Svg = void 0;
exports.getSvgStyles = getSvgStyles;
var _styles = require("../styles");
/*
Copyright (c) Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
function getSvgStyles({
$theme,
$size,
$color
}) {
let size = $theme.sizing.scale600;
if ($size) {
// @ts-ignore
if ($theme.sizing[$size]) {
// @ts-ignore
size = $theme.sizing[$size];
} else if (typeof $size === 'number') {
size = `${$size}px`;
} else {
size = $size;
}
}
let color = 'currentColor';
if ($color) {
// @ts-ignore
if ($theme.colors[$color]) {
// @ts-ignore
color = $theme.colors[$color];
} else {
color = $color;
}
}
return {
display: 'inline-block',
fill: color,
color: color,
height: size,
width: size
};
}
const Svg = exports.Svg = (0, _styles.styled)('svg', getSvgStyles);
Svg.displayName = "Svg";
Svg.displayName = 'Svg';