Skip to content

Open source personal finance application

refactor: improve component styles and layout consistency

Ilya Komichev7ba5f7783769
diff --git a/app/components/categories/Header.vue b/app/components/categories/Header.vue
index 2f2fe46e..c062e33d 100644
--- a/app/components/categories/Header.vue
+++ b/app/components/categories/Header.vue
@@ -16,7 +16,7 @@ const props = defineProps<{
<div
v-if="props.parentCategory"
- class="text-item-2 @lg:text-base flex items-center gap-2 pt-[3px] text-xs font-medium leading-none"
+ class="@lg:text-base flex items-center gap-2 pt-[3px] text-xs font-medium leading-none text-item-2"
>
<div class="text-2xs text-4">
•
diff --git a/app/components/categories/Selector.vue b/app/components/categories/Selector.vue
index 0e8cd4c4..4e0e2970 100644
--- a/app/components/categories/Selector.vue
+++ b/app/components/categories/Selector.vue
@@ -84,7 +84,6 @@ onMounted(() => {
v-if="opened.includes(categoryId) && categoriesStore.hasChildren(categoryId)"
class="pb-2 pl-4 pr-2"
>
- <!-- :activeItemId="isEveryChildsSelected(categoryId) ? null : props.selectedIds?.includes(childCategoryId) ? childCategoryId : null" -->
<CategoriesItem
v-for="childCategoryId in categoriesStore.getChildsIds(categoryId)"
:key="childCategoryId"
diff --git a/app/components/date/LinkItem.vue b/app/components/date/LinkItem.vue
index d5923baa..70f1b2d3 100644
--- a/app/components/date/LinkItem.vue
+++ b/app/components/date/LinkItem.vue
@@ -12,7 +12,7 @@ const emit = defineEmits<{
<template>
<div
:class="[
- getStyles('item', ['link', 'bg', 'padding3', 'center2', 'minh3', 'minw1', 'rounded3']),
+ getStyles('item', ['link', '_bg', 'padding3', 'center2', 'minh3', 'minw1', 'rounded3']),
{
'!bg-item-5': props.isActive,
},
diff --git a/app/components/date/LinkItemNoBg.vue b/app/components/date/LinkItemNoBg.vue
index 87ec4d84..bfca5945 100644
--- a/app/components/date/LinkItemNoBg.vue
+++ b/app/components/date/LinkItemNoBg.vue
@@ -12,7 +12,7 @@ const emit = defineEmits<{
<template>
<div
:class="[
- getStyles('item', ['center2', 'padding3', 'minh3']), {
+ getStyles('item', ['center2', 'padding4', 'minh3']), {
'bg-item-5 text-accent-1': props.isActive,
},
]"
diff --git a/app/components/stat/Config.vue b/app/components/stat/Config.vue
index ea10817b..d0362019 100644
--- a/app/components/stat/Config.vue
+++ b/app/components/stat/Config.vue
@@ -40,7 +40,7 @@ const isShow = ref(false)
<BottomSheetClose @click="close" />
<!-- Chart -->
- <div class="border-item-3 border-b pb-3">
+ <div class="border-b border-item-3 pb-3">
<UiTitleOption class="pb-2">
{{ t("stat.config.chartShow.title") }}
</UiTitleOption>
@@ -108,7 +108,7 @@ const isShow = ref(false)
<!-- Showed wallets -->
<div
v-if="props.isShowWallets"
- class="border-item-3 border-b pb-3"
+ class="border-b border-item-3 pb-3"
>
<UiTitleOption class="pb-2">
{{ t("stat.config.wallets.title") }}
diff --git a/app/components/stat/date/Quick.vue b/app/components/stat/date/Quick.vue
index 99549a79..b2d33a92 100644
--- a/app/components/stat/date/Quick.vue
+++ b/app/components/stat/date/Quick.vue
@@ -33,7 +33,8 @@ onMounted(() => {
observeParents: true,
observer: true,
shortSwipes: false,
- slidesPerView: 1,
+ slidesPerView: 'auto',
+ spaceBetween: 16,
touchStartPreventDefault: false,
})
})
@@ -56,12 +57,12 @@ function setMaxRange(isSkipEmpty = false) {
</script>
<template>
- <div class="relative w-full overflow-hidden">
+ <div class="relative ml-1 overflow-hidden rounded-lg bg-foreground-2">
<div ref="sliderRef" class="swiper-container">
<div class="swiper-wrapper">
<!-- Recent -->
- <div class="swiper-slide">
- <div class="flex flex-wrap gap-1">
+ <div class="swiper-slide !w-auto">
+ <div class="flex flex-wrap">
<DateRanges @onClose="emit('onClose')" />
<div class="flex">
@@ -78,14 +79,14 @@ function setMaxRange(isSkipEmpty = false) {
</div>
</div>
- <div class="swiper-slide">
- <div class="flex flex-wrap gap-1">
+ <div class="swiper-slide !w-auto">
+ <div class="flex flex-wrap">
<DateRanges2 @onClose="emit('onClose')" />
</div>
</div>
- <div class="swiper-slide">
- <div class="flex flex-wrap gap-1">
+ <div class="swiper-slide !w-auto">
+ <div class="flex flex-wrap">
<DateLinkItem
:isActive="statDate.params.value.isShowMaxRange && !statDate.params.value.isSkipEmpty"
@click="() => setMaxRange(false)"
diff --git a/app/components/stat/sum/Wrap.vue b/app/components/stat/sum/Wrap.vue
index be6cded0..8d84005b 100644
--- a/app/components/stat/sum/Wrap.vue
+++ b/app/components/stat/sum/Wrap.vue
@@ -35,10 +35,10 @@ function onClick(type: MoneyTypeSlugNew) {
</script>
<template>
- <div class="rounded-md md:max-w-lg pb-4">
+ <div class="rounded-md pb-4 md:max-w-lg">
<div
v-if="props.type === 'netIncome'"
- class="flex flex-wrap _justify-stretch"
+ class="_justify-stretch flex flex-wrap"
>
<StatSumItem
v-if="props.isShowExpense"
diff --git a/app/components/trnForm/Main.vue b/app/components/trnForm/Main.vue
index 35f59851..462842ef 100644
--- a/app/components/trnForm/Main.vue
+++ b/app/components/trnForm/Main.vue
@@ -96,7 +96,7 @@ const actions = computed(() => ({
/>
<UiTitle3
- class="bg-foreground-1 sticky top-0 z-10 px-3 pb-3 pt-4 md:text-xl"
+ class="sticky top-0 z-10 bg-foreground-1 px-3 pb-3 pt-4 md:text-xl"
@click="trnsFormStore.values.trnId = null"
>
{{ trnsFormStore.values.trnId ? t("trnForm.titleEditTrn") : t("trnForm.createTrn") }}
@@ -108,7 +108,7 @@ const actions = computed(() => ({
>
<TrnsItem
:trnItem="trnsStore.computeTrnItem(trnsFormStore.values.trnId)"
- class="bg-item-4 group rounded-lg"
+ class="group rounded-lg bg-item-4"
@click="trnsFormStore.values.trnId = null"
/>
@@ -116,7 +116,7 @@ const actions = computed(() => ({
v-if="showModalConfirm"
class="absolute -bottom-4 left-0 z-10 w-full px-4"
>
- <div class="border-accent-1 bg-foreground-1 text-1 z-10 grid h-full content-center gap-4 rounded-lg border p-3">
+ <div class="z-10 grid h-full content-center gap-4 rounded-lg border border-accent-1 bg-foreground-1 p-3 text-1">
{{ t('base.sure') }}
<div class="flex gap-2">
@@ -134,7 +134,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="text-2 leading-none">
+ <div class="leading-none text-2">
{{ t(item.localeKey) }}
</div>
</UiElement>
@@ -156,7 +156,7 @@ const actions = computed(() => ({
/>
</template>
- <div class="text-2 leading-none">
+ <div class="leading-none text-2">
{{ t(item.localeKey) }}
</div>
</DateLinkItem>
diff --git a/app/components/ui/getStyles.ts b/app/components/ui/getStyles.ts
index d56cdb3e..e8ccd834 100644
--- a/app/components/ui/getStyles.ts
+++ b/app/components/ui/getStyles.ts
@@ -26,7 +26,6 @@ export const classes = {
padding1: 'px-2 py-1.5',
padding2: 'px-2',
padding3: 'px-3',
-
padding4: 'px-1',
rounded: 'rounded-md',