@equinor/eds-core-react
Version:
The React implementation of the Equinor Design System
31 lines (28 loc) • 979 B
JavaScript
import styled, { css } from 'styled-components';
import { close } from '@equinor/eds-icons';
import { Icon as Icon$1 } from '../Icon/index.js';
import * as Chip_tokens from './Chip.tokens.js';
import { bordersTemplate } from '@equinor/eds-utils';
Icon$1.add({
close
});
const {
enabled,
error
} = Chip_tokens;
const Icon = styled(Icon$1).withConfig({
displayName: "Icon",
componentId: "sc-50ffvg-0"
})(["cursor:pointer;padding:1px;", " &:hover{", ";}", ""], bordersTemplate(enabled.entities.icon.border), ({
$variant
}) => {
switch ($variant) {
case 'error':
return css(["background:", ";svg{fill:", ";}"], error.entities.icon.background, error.entities.icon.typography.color);
default:
return css(["background:", ";svg{fill:", ";}"], enabled.entities.icon.states.hover.background, enabled.states.hover.typography.color);
}
}, ({
$disabled
}) => $disabled && css(["cursor:not-allowed;&:hover{background:transparent;}"]));
export { Icon };