Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3362] Sidebar on mobile #3379

Merged
merged 16 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docs/components/layout/header/HeaderSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default defineComponent({
props: {
minimized: {
type: Boolean,
required: true,
default: false,
RVitaly1978 marked this conversation as resolved.
Show resolved Hide resolved
},
},
emits: ['toggle-sidebar'],
Expand Down
5 changes: 4 additions & 1 deletion packages/docs/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<aside class="docs-layout__sidebar">
<LayoutSidebar
v-model:visible="isSidebarVisible"
:mobile="breakpoints.sm"
:mobile="isMobileSidebar"
RVitaly1978 marked this conversation as resolved.
Show resolved Hide resolved
/>
</aside>
<main class="docs-layout__main-content">
Expand All @@ -38,12 +38,14 @@ const breakpoints = useBreakpoint()

const isSidebarVisible = ref(false)
const isOptionsVisible = ref(false)
const isMobileSidebar = ref(false)

applyPreset(cookie.value || 'light')

watch(() => breakpoints.smDown, (newValue: boolean) => {
isSidebarVisible.value = !newValue
isOptionsVisible.value = false
isMobileSidebar.value = newValue
})

const { afterEach } = useRouter()
Expand All @@ -57,6 +59,7 @@ afterEach(() => {
onMounted(() => {
scrollToElement()
isSidebarVisible.value = !breakpoints.smDown
isMobileSidebar.value = breakpoints.smDown
})

useHead({
Expand Down