UNPKG

@brizy/ui

Version:
22 lines (21 loc) 960 B
import { getHexByColorType } from "../utils/colors"; import { BRZ_PREFIX } from "../constants"; export const getOverlayProperties = (width, offset) => { const hasWidth = width !== undefined; const hasOffset = offset !== undefined; if (hasWidth || hasOffset) { return Object.assign(Object.assign({}, (hasWidth && { [`--${BRZ_PREFIX}-dropdown-content-width`]: `${width}px`, })), (hasOffset && { [`--${BRZ_PREFIX}-dropdown-content-offset`]: `${offset}px`, })); } }; export const getItemProperties = (color) => { const { background, hoverBackground } = color || {}; if (background || hoverBackground) { return Object.assign(Object.assign({}, (background && { [`--${BRZ_PREFIX}-dropdown-item-background`]: getHexByColorType(background) })), (hoverBackground && { [`--${BRZ_PREFIX}-dropdown-item-hover-background`]: getHexByColorType(hoverBackground), })); } };