@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
42 lines (41 loc) • 1.21 kB
JavaScript
/**
* @jsxRuntime classic
* @jsx jsx
*/
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports -- Ignored via go/DSP-18766; jsx required at runtime for @jsxRuntime classic
import { css, jsx } from '@emotion/react';
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
import { Box, xcss } from '@atlaskit/primitives';
const barStyles = css({
position: 'absolute',
left: 0,
right: 0,
top: '18px',
margin: 'auto',
width: "var(--ds-space-200, 16px)",
height: '3px'
});
const textColorIconWrapper = xcss({
position: 'relative'
});
const getBackground = (selectedColor, disabled) => {
if (selectedColor) {
return selectedColor;
}
return disabled ? "var(--ds-icon-disabled, #080F214A)" : "var(--ds-icon, #292A2E)";
};
export const DynamicStrokeIconDecoration = ({
selectedColor,
disabled,
icon
}) => {
return jsx(Box, {
xcss: textColorIconWrapper
}, icon, jsx("div", {
"data-testid": "toolbar-icon-dynamic-stroke",
style: {
background: getBackground(selectedColor, disabled)
},
css: barStyles
}));
};