UNPKG

terriajs

Version:

Geospatial data visualization platform.

39 lines 1.12 kB
import { jsx as _jsx } from "react/jsx-runtime"; import styled from "styled-components"; import { GLYPHS, StyledIcon } from "../../Icon"; const StyledCheckboxIcon = styled(StyledIcon).attrs({ styledWidth: "1em" }) ` top: 0.125em; align-self: flex-start; position: relative; fill: currentColor; ${(props) => !props.disabled && ` &:hover { opacity: 0.6; } `} ${(props) => props.isSwitch && ` width: 28px; &:hover { opacity: 0.95; } `} `; const CheckboxIcon = (props) => { const iconOn = props.isSwitch ? GLYPHS.switchOn : GLYPHS.checkboxOn; const iconOff = props.isSwitch ? GLYPHS.switchOff : GLYPHS.checkboxOff; if (props.isDisabled) { return (_jsx(StyledCheckboxIcon, { glyph: props.isChecked ? iconOn : iconOff, disabled: true, isSwitch: props.isSwitch, css: ` cursor: not-allowed; opacity: 0.3; ` })); } else { return (_jsx(StyledCheckboxIcon, { isSwitch: props.isSwitch, glyph: props.isChecked ? iconOn : iconOff })); } }; export default CheckboxIcon; //# sourceMappingURL=CheckboxIcon.js.map