mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 16:07:33 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import colorConstants from '../consts/color.js';
|
||||
|
||||
export default function (color, defaultColor) {
|
||||
if (color && color !== colorConstants.defaultAccountColor) {
|
||||
color = '#' + color;
|
||||
} else {
|
||||
color = defaultColor;
|
||||
}
|
||||
|
||||
return {
|
||||
color: color
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import colorConstants from '../consts/color.js';
|
||||
|
||||
export default function (color, defaultColor) {
|
||||
if (color && color !== colorConstants.defaultCategoryColor) {
|
||||
color = '#' + color;
|
||||
} else {
|
||||
color = defaultColor;
|
||||
}
|
||||
|
||||
return {
|
||||
color: color
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import colorConstants from '../consts/color.js';
|
||||
|
||||
export default function (color, defaultColor) {
|
||||
if (color && color !== colorConstants.defaultColor) {
|
||||
color = '#' + color;
|
||||
} else {
|
||||
color = defaultColor;
|
||||
}
|
||||
|
||||
return {
|
||||
color: color
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import defaultIconStyle from "./defaultIconStyle.js";
|
||||
import accountIconStyle from "./accountIconStyle.js";
|
||||
import categoryIconStyle from "./categoryIconStyle.js";
|
||||
|
||||
export default function (color, iconType, defaultColor) {
|
||||
if (iconType === 'account') {
|
||||
return accountIconStyle(color, defaultColor);
|
||||
} else if (iconType === 'category') {
|
||||
return categoryIconStyle(color, defaultColor);
|
||||
} else {
|
||||
return defaultIconStyle(color, defaultColor);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user