Skip to content

Commit

Permalink
fix: added resizer in side panel
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Oct 29, 2024
1 parent 79a9545 commit 069b585
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 7 additions & 3 deletions frontend/src/components/Resizer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
<div class="relative" :style="{ width: `${sidebarWidth}px` }">
<slot v-bind="{ sidebarResizing, sidebarWidth }" />
<div
class="absolute left-0 z-10 h-full w-1 cursor-col-resize bg-gray-300 opacity-0 transition-opacity hover:opacity-100"
:class="{ 'opacity-100': sidebarResizing }"
class="absolute z-10 h-full w-1 cursor-col-resize bg-gray-300 opacity-0 transition-opacity hover:opacity-100"
:class="{
'opacity-100': sidebarResizing,
'left-0': side == 'right',
'right-0': side == 'left',
}"
@mousedown="startResize"
/>
</div>
Expand Down Expand Up @@ -81,6 +85,6 @@ function resize(e) {
function distance() {
if (!props.parent) return 0
const rect = props.parent.getBoundingClientRect()
return window.innerWidth - rect[props.side]
return rect[props.side]
}
</script>
10 changes: 6 additions & 4 deletions frontend/src/pages/Contact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
</Breadcrumbs>
</template>
</LayoutHeader>
<div class="flex h-full">
<div
<div ref="parentRef" class="flex h-full">
<Resizer
v-if="contact.data"
class="flex h-full flex-col overflow-hidden border-r min-w-[352px]"
:parent="$refs.parentRef"
class="flex h-full flex-col overflow-hidden border-r"
>
<div class="border-b">
<FileUploader
Expand Down Expand Up @@ -148,7 +149,7 @@
</div>
</div>
</div>
</div>
</Resizer>
<Tabs class="overflow-hidden" v-model="tabIndex" :tabs="tabs">
<template #tab="{ tab, selected }">
<button
Expand Down Expand Up @@ -203,6 +204,7 @@
</template>

<script setup>
import Resizer from '@/components/Resizer.vue'
import Icon from '@/components/Icon.vue'
import Section from '@/components/Section.vue'
import SectionFields from '@/components/SectionFields.vue'
Expand Down

0 comments on commit 069b585

Please sign in to comment.