feat: vertical and horizontal layout support

This commit is contained in:
liyasthomas
2021-09-20 10:17:31 +05:30
parent 49741875bd
commit dcbb17b164
13 changed files with 72 additions and 14 deletions

View File

@@ -61,19 +61,24 @@ import useWindowSize from "~/helpers/utils/useWindowSize"
function appLayout() {
const rightSidebar = useSetting("RIGHT_SIDEBAR")
const columnLayout = useSetting("COLUMN_LAYOUT")
const windowInnerWidth = useWindowSize()
// Initially apply
onBeforeMount(() => {
if (windowInnerWidth.x.value < 768) rightSidebar.value = false
if (windowInnerWidth.x.value < 768) {
rightSidebar.value = false
columnLayout.value = true
}
})
// Listen for updates
watch(windowInnerWidth.x, () =>
windowInnerWidth.x.value >= 768
? (rightSidebar.value = true)
: (rightSidebar.value = false)
)
watch(windowInnerWidth.x, () => {
if (windowInnerWidth.x.value < 768) {
rightSidebar.value = false
columnLayout.value = true
}
})
}
function updateThemes() {