Skip to content

Commit

Permalink
refactor(app-layout): emit topOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Jan 10, 2025
1 parent 16d2233 commit c87328a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/core/app-layout/src/components/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

<script setup lang="ts">
import type { PropType } from 'vue'
import { ref, reactive, computed, watchEffect, onMounted, onBeforeUnmount, toRef, useSlots } from 'vue'
import { ref, reactive, computed, watchEffect, onMounted, onBeforeUnmount, toRef, useSlots, watch } from 'vue'
import AppNavbar from './navbar/AppNavbar.vue'
import AppSidebar from './sidebar/AppSidebar.vue'
import SidebarToggle from './sidebar/SidebarToggle.vue'
Expand Down Expand Up @@ -171,7 +171,10 @@ const props = defineProps({
},
})
const emit = defineEmits(['sidebar-click'])
const emit = defineEmits<{
(e: 'sidebar-click', item: SidebarPrimaryItem | SidebarSecondaryItem): void
(e: 'update:topOffset', offset: number): void
}>()
const slots = useSlots()
const slotContent = reactive({
Expand Down Expand Up @@ -243,12 +246,9 @@ const debouncedSetNotificationHeight = debounce((force = false): void => {
// Add a ResizeObserver to determine when the navbar element content changes
const resizeObserver = ref<ResizeObserver>()
const topOffset = computed((): number => notificationHeight.value)
defineExpose({
/** Expose the computed top offset */
topOffset,
})
watch(notificationHeight, (offset) => {
emit('update:topOffset', offset || 0)
}, { immediate: true })
onMounted(() => {
// Add classes to the `html` and `body` elements to scope styles
Expand Down

0 comments on commit c87328a

Please sign in to comment.