code refactor

This commit is contained in:
MaysWind
2020-12-21 23:45:00 +08:00
parent 154589c368
commit fb1f0bc54e
16 changed files with 81 additions and 20 deletions
+13
View File
@@ -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
};
}
+13
View File
@@ -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
};
}
+13
View File
@@ -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
};
}
+13
View File
@@ -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);
}
}