Skip to content

Commit

Permalink
docs: fit view on features flows on wrapper resize
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Jun 13, 2022
1 parent 2bd81fe commit 1400011
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/components/home/Features.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { VueFlowStore } from '@braks/vue-flow'
const breakpoints = useBreakpoints(breakpointsTailwind)
const el = ref()
const instances: VueFlowStore[] = []
const onLoad = (instance: VueFlowStore) => {
Expand All @@ -15,13 +16,15 @@ const fitViews = () => {
instances.forEach((i) => i.fitView())
}
watchDebounced([breakpoints.sm, breakpoints.md, breakpoints.lg, breakpoints.xl, breakpoints['2xl']], () => fitViews(), {
debounce: 50,
})
const { stop } = useResizeObserver(
el,
useDebounceFn(() => fitViews(), 5),
)
onBeforeUnmount(stop)
</script>

<template>
<div class="w-full dark:(bg-black text-white)">
<div ref="el" class="w-full dark:(bg-black text-white)">
<div
class="flex flex-col divide-y divide-gray-500 md:divide-y-0 gap-12 md:gap-24 lg:gap-36 max-w-9/12 md:max-w-11/12 lg:max-w-9/12 m-auto py-12 md:py-24 text-center md:text-left"
>
Expand Down

2 comments on commit 1400011

@vercel
Copy link

@vercel vercel bot commented on 1400011 Jun 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1400011 Jun 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.