zarm-web
Version:
基于 React 的桌面端UI库
36 lines (32 loc) • 684 B
JavaScript
import { isAddon } from './PropsType';
const DEFAULT_THEME_COLOR = '#F2F2F2';
const DEFAULT_FILL_COLOR = '#00BC70';
const colorTheme = {
fill: DEFAULT_FILL_COLOR,
default: DEFAULT_THEME_COLOR
};
export function handleFillType(fillType) {
if (!fillType) {
return DEFAULT_THEME_COLOR;
}
const color = colorTheme[fillType];
return color || fillType;
}
export function handlAddonProps(addon) {
if (typeof addon === 'function') {
return {
fillType: 'default',
addon: addon()
};
}
if (isAddon(addon)) {
if (!addon.fillType) {
addon.fillType = 'default';
}
return addon;
}
return {
fillType: 'default',
addon
};
}