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

[stable29] fix(outline): fix mobile detection and box shadow #6738

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 10 additions & 23 deletions src/components/Editor/EditorOutline.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div data-text-el="editor-outline" class="editor--outline" :class="{ 'editor--outline-mobile': mobile }">
<div data-text-el="editor-outline" class="editor--outline" :class="{ 'editor--outline-mobile': $isMobile }">
<header class="editor--outline__header">
<NcButton class="editor--outline__btn-close"
type="tertiary"
Expand All @@ -21,6 +21,7 @@ import TableOfContents from './TableOfContents.vue'
import { useOutlineStateMixin, useOutlineActions } from './Wrapper.provider.js'
import { Close } from './../icons.js'
import useStore from '../../mixins/store.js'
import { useIsMobileMixin } from '../Editor.provider.js'
export default {
name: 'EditorOutline',
Expand All @@ -29,27 +30,12 @@ export default {
NcButton,
TableOfContents,
},
mixins: [useStore, useOutlineStateMixin, useOutlineActions],
data: () => ({
mobile: false,
}),
mounted() {
this.$resizeObserver = new ResizeObserver(this.onResize)
this.$resizeObserver.observe(this.$el.parentElement)
this.onResize()
},
beforeDestroy() {
this.$resizeObserver.unobserve(this.$el.parentElement)
this.$resizeObserver = null
this.$onResize = null
},
methods: {
onResize([el]) {
window.requestAnimationFrame(() => {
this.mobile = el.clientWidth < 320
})
},
},
mixins: [
useIsMobileMixin,
useStore,
useOutlineStateMixin,
useOutlineActions,
],
}
</script>

Expand All @@ -63,7 +49,8 @@ export default {
max-height: calc(100% - 204px);
&-mobile {
box-shadow: 8px 0 17px -19px var(--color-box-shadow);
border-radius: var(--border-radius-large);
box-shadow: 0 1px 10px var(--color-box-shadow);
background-color: var(--color-main-background-translucent);
z-index: 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Editor/Wrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default {
return false
}

return this.viewWidth > 1265
return true
},
},

Expand Down
Loading