Skip to content

Open source personal finance application

feat(Form): refactor colors

ilkomed00c434a43e9
diff --git a/components/categories/Form.vue b/components/categories/Form.vue
index dfb341e7..d32c3f9b 100644
--- a/components/categories/Form.vue
+++ b/components/categories/Form.vue
@@ -226,37 +226,36 @@ div
//- Colors
//---------------------------------
template(v-if="activeTab === 'colors'")
- div
- div
- .pb-1(
- v-for="(colorsGroup, groupIdx) in allColors"
- :key="groupIdx"
- )
- .colors
- .iconItem(
- v-for="(color, idx) in colorsGroup"
- :key="idx"
- :class="{ _active: color === categoryForm.color, 'pointer-events-none': !color }"
- :style="{ background: color === categoryForm.color ? color : 'transparent' }"
- @click="emit('updateValue', 'color', color)"
- )
- template(v-if="findCategoryWithThisColor(color)")
- Icon(
- :icon="color === categoryForm.color ? categoryForm.icon : findCategoryWithThisColor(color)"
- :background="color"
- round
- )
- template(v-else-if="color === categoryForm.color")
- Icon(
- :icon="categoryForm.icon"
- background="transparent"
- big
- )
- template(v-else-if="color")
- .colorPreview(:style="{ background: color }")
-
- .pb-2.text-sm.text-skin-item-base-down {{ $t('wallets.form.colors.custom') }}
- input.cursor-pointer.w-full.h-12.p-0.border-0(v-model="categoryForm.color" type="color")
+ .pb-4
+ .pb-1(
+ v-for="(colorsGroup, groupIdx) in allColors"
+ :key="groupIdx"
+ )
+ .colors
+ .iconItem(
+ v-for="(color, idx) in colorsGroup"
+ :key="idx"
+ :class="{ _active: color === categoryForm.color, 'pointer-events-none': !color }"
+ :style="{ background: color === categoryForm.color ? color : 'transparent' }"
+ @click="emit('updateValue', 'color', color)"
+ )
+ template(v-if="findCategoryWithThisColor(color)")
+ Icon(
+ :icon="color === categoryForm.color ? categoryForm.icon : findCategoryWithThisColor(color)"
+ :background="color"
+ round
+ )
+ template(v-else-if="color === categoryForm.color")
+ Icon(
+ :icon="categoryForm.icon"
+ background="transparent"
+ big
+ )
+ template(v-else-if="color")
+ .colorPreview(:style="{ background: color }")
+
+ .pb-2.text-sm.text-skin-item-base-down {{ $t('wallets.form.colors.custom') }}
+ input.cursor-pointer.w-full.h-12.p-0.border-0(v-model="categoryForm.color" type="color")
//- Parent
//---------------------------------
diff --git a/components/wallets/Form.vue b/components/wallets/Form.vue
index 971d8f67..f9c2919d 100644
--- a/components/wallets/Form.vue
+++ b/components/wallets/Form.vue
@@ -146,19 +146,22 @@ div(v-if="walletForm")
//- Colors
//---------------------------------
template(v-if="activeTab === 'colors'")
- .colors
- .iconItem(
- v-for="(color, idx) in allColors"
- :key="idx"
- :class="{ _active: color === walletForm.color, '_empty pointer-events-none': !color }"
- :style="{ background: color === walletForm.color ? color : 'transparent' }"
- @click="emit('updateValue', 'color', color)"
+ .pb-4
+ .pb-1(
+ v-for="(colorsGroup, groupIdx) in allColors"
+ :key="groupIdx"
)
-
- template(v-if="color")
- .colorPreview(:style="{ background: color }")
-
- .pb-2.text-sm.text-skin-item-base-down {{ $t('categories.form.colors.custom') }}
+ .colors
+ .iconItem(
+ v-for="(color, idx) in colorsGroup"
+ :key="idx"
+ :class="{ _active: color === walletForm.color, 'pointer-events-none': !color }"
+ :style="{ background: color === walletForm.color ? color : 'transparent' }"
+ @click="emit('updateValue', 'color', color)"
+ )
+ .colorPreview(:style="{ background: color }")
+
+ .pb-2.text-sm.text-skin-item-base-down {{ $t('wallets.form.colors.custom') }}
input.cursor-pointer.w-full.h-12.p-0.border-0(v-model="walletForm.color" type="color")
.pt-4.pb-6