Skip to content

Commit 7efb026

Browse files
authoredMar 28, 2024··
feat(client): responsive layout for components panel (#298)
1 parent c7097ea commit 7efb026

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎packages/client/src/pages/components.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,18 @@ watchDebounced(filterName, (v) => {
259259
}, { debounce: 300 })
260260
261261
const devtoolsState = useDevToolsState()
262+
263+
// responsive layout
264+
const splitpanesRef = ref<HTMLDivElement>()
265+
const splitpanesReady = ref(false)
266+
const { width: splitpanesWidth } = useElementSize(splitpanesRef)
267+
// prevent `Splitpanes` layout from being changed before it ready
268+
const horizontal = computed(() => splitpanesReady.value ? splitpanesWidth.value < 700 : false)
262269
</script>
263270

264271
<template>
265272
<PanelGrids h-screen>
266-
<Splitpanes>
273+
<Splitpanes ref="splitpanesRef" :horizontal="horizontal" @ready="splitpanesReady = true">
267274
<Pane flex flex-col border="r base">
268275
<div w-full flex gap2 px2 py2>
269276
<VueInput v-if="loaded" v-model="filterName" :loading-debounce-time="250" :loading="!filtered" placeholder="Find components..." flex-1 />

0 commit comments

Comments
 (0)
Please sign in to comment.