Skip to content

Open source personal finance application

feat(UiHeader): add sticky prop for header component

Ilya Komichev848dc3a96931
diff --git a/app/components/trns/pages/History.vue b/app/components/trns/pages/History.vue
index 995388b8..f43a153e 100644
--- a/app/components/trns/pages/History.vue
+++ b/app/components/trns/pages/History.vue
@@ -46,8 +46,8 @@ watch([filter.categoriesIds, filter.walletsIds], () => {
<template>
<UiPage>
- <UiHeader>
- <UiHeaderTitle>{{ t("trns.history") }}</UiHeaderTitle>
+ <UiHeader sticky>
+ <UiHeaderTitle>{{ t('trns.history') }}</UiHeaderTitle>
<template #actions>
<StatFilterSelector
class="flex gap-1"
diff --git a/app/components/ui/Header.vue b/app/components/ui/Header.vue
index b88b53df..1b1818c3 100644
--- a/app/components/ui/Header.vue
+++ b/app/components/ui/Header.vue
@@ -1,5 +1,18 @@
+<script setup lang="ts">
+import { cn } from '~~/lib/cn'
+
+const props = defineProps<{
+ sticky?: boolean
+}>()
+</script>
+
<template>
- <div class="bg-default/90 top-0 z-20 mb-2 backdrop-blur lg:sticky">
+ <div
+ :class="cn([
+ 'bg-default/90 top-0 z-20 mb-2 backdrop-blur lg:sticky',
+ props.sticky && 'sticky',
+ ])"
+ >
<div class="border-item-4 grid min-h-12 max-w-7xl items-center border-b px-2 py-2 lg:px-4 lg:py-4 2xl:px-8">
<div class="flex grow items-center gap-2">
<slot />