UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

93 lines (92 loc) 2.45 kB
import { fg } from '@atlaskit/platform-feature-flags'; export const iconOnlySpacing = { '&&': { padding: '0px' }, '& > span': { margin: '0px' } }; const getStyles = (property, { appearance = 'default', state = 'default', mode = 'light' }) => { if (!property[appearance] || !property[appearance][state]) { return 'initial'; } return property[appearance][state][mode]; }; const background = { danger: { default: { light: 'inherit', dark: 'inherit' }, hover: { light: "var(--ds-background-neutral-subtle-hovered, #091E420F)", dark: "var(--ds-background-neutral-subtle-hovered, #091E420F)" }, active: { light: "var(--ds-background-neutral-pressed, #091E424F)", dark: "var(--ds-background-neutral-pressed, #091E424F)" } } }; const backgroundVisualRefresh = { danger: { default: { light: 'inherit', dark: 'inherit' }, hover: { light: "var(--ds-background-danger-hovered, #FFD5D2)", dark: "var(--ds-background-danger-hovered, #FFD5D2)" }, active: { light: "var(--ds-background-danger-pressed, #FD9891)", dark: "var(--ds-background-danger-pressed, #FD9891)" } } }; const color = { danger: { default: { light: "var(--ds-icon, #44546F)", dark: "var(--ds-icon, #44546F)" }, hover: { light: "var(--ds-icon-danger, #C9372C)", dark: "var(--ds-icon-danger, #C9372C)" }, active: { light: "var(--ds-icon-danger, #C9372C)", dark: "var(--ds-icon-danger, #C9372C)" } } }; const colorVisualRefresh = { danger: { default: { light: "var(--ds-icon-subtle, #626F86)", dark: "var(--ds-icon-subtle, #626F86)" }, hover: { light: "var(--ds-icon-danger, #C9372C)", dark: "var(--ds-icon-danger, #C9372C)" }, active: { light: "var(--ds-icon-danger, #C9372C)", dark: "var(--ds-icon-danger, #C9372C)" } } }; // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any export const getButtonStyles = props => ({ background: getStyles( // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix fg('platform-visual-refresh-icons') ? backgroundVisualRefresh : background, props), // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix color: getStyles(fg('platform-visual-refresh-icons') ? colorVisualRefresh : color, props) });