refactor: hide right sidebars by default on mobile devices

This commit is contained in:
liyasthomas
2021-09-08 13:56:02 +05:30
parent 73f22abf56
commit 2cf55cbb96
2 changed files with 20 additions and 1 deletions

View File

@@ -59,6 +59,23 @@ import { hookKeybindingsListener } from "~/helpers/keybindings"
import { defineActionHandler } from "~/helpers/actions"
import useWindowSize from "~/helpers/utils/useWindowSize"
function appLayout() {
const rightSidebar = useSetting("RIGHT_SIDEBAR")
const windowInnerWidth = useWindowSize()
// Initially apply
onBeforeMount(() => {
if (windowInnerWidth.x.value < 768) rightSidebar.value = false
})
// Listen for updates
watch(windowInnerWidth.x, () =>
windowInnerWidth.x.value >= 768
? (rightSidebar.value = true)
: (rightSidebar.value = false)
)
}
function updateThemes() {
const { $colorMode } = useContext() as any
@@ -113,6 +130,8 @@ function defineJumpActions() {
export default defineComponent({
components: { Splitpanes, Pane },
setup() {
appLayout()
hookKeybindingsListener()
defineJumpActions()