@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
68 lines • 2.04 kB
JavaScript
import { hexToRgba } from '@atlaskit/adf-schema';
import { B75, DN400, N30A, N400, R400 } from '@atlaskit/theme/colors';
export var iconOnlySpacing = {
'&&': {
padding: '0px',
/**
Increased specificity here because css for .hyperlink-open-link defined in
packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
overrides padding left-right 2px with 4px.
*/
'&&[href]': {
padding: '0 2px'
}
},
'& > span': {
margin: '0px'
}
};
var getStyles = function getStyles(property, _ref) {
var _ref$appearance = _ref.appearance,
appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
_ref$state = _ref.state,
state = _ref$state === void 0 ? 'default' : _ref$state,
_ref$mode = _ref.mode,
mode = _ref$mode === void 0 ? 'light' : _ref$mode;
if (!property[appearance] || !property[appearance][state]) {
return 'initial';
}
return property[appearance][state][mode];
};
var background = {
danger: {
default: {
light: 'inherit',
dark: 'inherit'
},
hover: {
light: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")"),
dark: "var(--ds-background-neutral-subtle-hovered, ".concat(N30A, ")")
},
active: {
light: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(B75, 0.6)), ")"),
dark: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(B75, 0.6)), ")")
}
}
};
var color = {
danger: {
default: {
light: "var(--ds-icon, ".concat(N400, ")"),
dark: "var(--ds-icon, ".concat(DN400, ")")
},
hover: {
light: "var(--ds-icon-danger, ".concat(R400, ")"),
dark: "var(--ds-icon-danger, ".concat(R400, ")")
},
active: {
light: "var(--ds-icon-danger, ".concat(R400, ")"),
dark: "var(--ds-icon-danger, ".concat(R400, ")")
}
}
};
export var getButtonStyles = function getButtonStyles(props) {
return {
background: getStyles(background, props),
color: getStyles(color, props)
};
};