mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-08 09:16:58 +08:00
优化垂直导航样式,修复边框半径设置,删除不必要的代码,移除 TransitionExpand 组件
This commit is contained in:
@@ -118,11 +118,6 @@
|
|||||||
opacity: var(--v-disabled-opacity);
|
opacity: var(--v-disabled-opacity);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 👉 Vertical nav link
|
|
||||||
.nav-link {
|
|
||||||
@extend %nav-link;
|
|
||||||
|
|
||||||
> .router-link-exact-active {
|
> .router-link-exact-active {
|
||||||
@extend %nav-link-active;
|
@extend %nav-link-active;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ $header: ".layout-navbar";
|
|||||||
// If navbar is contained => Add border radius to header
|
// If navbar is contained => Add border radius to header
|
||||||
@if variables.$layout-vertical-nav-navbar-is-contained {
|
@if variables.$layout-vertical-nav-navbar-is-contained {
|
||||||
#{$header} {
|
#{$header} {
|
||||||
// border-radius: 0 0 variables.$default-layout-with-vertical-nav-navbar-footer-roundness variables.$default-layout-with-vertical-nav-navbar-footer-roundness;
|
border-radius: 0 0 variables.$default-layout-with-vertical-nav-navbar-footer-roundness variables.$default-layout-with-vertical-nav-navbar-footer-roundness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ $header: ".layout-navbar";
|
|||||||
/* ℹ️ This html selector with not selector is required when:
|
/* ℹ️ This html selector with not selector is required when:
|
||||||
dialog is opened and window don't have any scroll. This removes window-scrolled class from layout and out style broke
|
dialog is opened and window don't have any scroll. This removes window-scrolled class from layout and out style broke
|
||||||
*/
|
*/
|
||||||
html.v-overlay-scroll-blocked:not([style*="--v-body-scroll-y: 0px;"]) .layout-navbar-fixed,
|
html.v-overlay-scroll-blocked .layout-navbar-fixed,
|
||||||
&.window-scrolled.layout-navbar-fixed {
|
&.window-scrolled.layout-navbar-fixed {
|
||||||
|
|
||||||
#{$header} {
|
#{$header} {
|
||||||
@@ -63,7 +63,7 @@ $header: ".layout-navbar";
|
|||||||
|
|
||||||
#{$header} {
|
#{$header} {
|
||||||
@if variables.$layout-vertical-nav-navbar-is-contained {
|
@if variables.$layout-vertical-nav-navbar-is-contained {
|
||||||
// border-radius: variables.$default-layout-with-vertical-nav-navbar-footer-roundness;
|
border-radius: variables.$default-layout-with-vertical-nav-navbar-footer-roundness;
|
||||||
}
|
}
|
||||||
|
|
||||||
background-color: rgb(var(--v-theme-surface));
|
background-color: rgb(var(--v-theme-surface));
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
|
|
||||||
.v-theme--light & {
|
.v-theme--light & {
|
||||||
border-radius: 0 0 16px 16px;
|
|
||||||
backdrop-filter: blur(16px);
|
backdrop-filter: blur(16px);
|
||||||
background: rgba(var(--v-theme-surface), 0.9);
|
background: rgba(var(--v-theme-surface), 0.9);
|
||||||
box-shadow: 0 0 8px 0 rgba(var(--v-theme-on-surface), 0.1);
|
box-shadow: 0 0 8px 0 rgba(var(--v-theme-on-surface), 0.1);
|
||||||
|
|||||||
@@ -1,209 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { Transition } from 'vue'
|
|
||||||
import { useDisplay } from 'vuetify'
|
|
||||||
import VerticalNav from '@layouts/components/VerticalNav.vue'
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
setup(props, { slots }) {
|
|
||||||
const isOverlayNavActive = ref(false)
|
|
||||||
const isLayoutOverlayVisible = ref(false)
|
|
||||||
const toggleIsOverlayNavActive = useToggle(isOverlayNavActive)
|
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
const { mdAndDown } = useDisplay()
|
|
||||||
|
|
||||||
// ℹ️ This is alternative to below two commented watcher
|
|
||||||
// We want to show overlay if overlay nav is visible and want to hide overlay if overlay is hidden and vice versa.
|
|
||||||
syncRef(isOverlayNavActive, isLayoutOverlayVisible)
|
|
||||||
|
|
||||||
const scrollDistance = ref(window.scrollY)
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
window.addEventListener('scroll', () => {
|
|
||||||
scrollDistance.value = window.scrollY
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
// 👉 Vertical nav
|
|
||||||
const verticalNav = h(
|
|
||||||
VerticalNav,
|
|
||||||
{ isOverlayNavActive: isOverlayNavActive.value, toggleIsOverlayNavActive },
|
|
||||||
{
|
|
||||||
'nav-header': () => slots['vertical-nav-header']?.(),
|
|
||||||
'before-nav-items': () => slots['before-vertical-nav-items']?.(),
|
|
||||||
'default': () => slots['vertical-nav-content']?.(),
|
|
||||||
'after-nav-items': () => slots['after-vertical-nav-items']?.(),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// 👉 Navbar
|
|
||||||
const navbar = h('header', { class: ['layout-navbar navbar-blur'] }, [
|
|
||||||
h(
|
|
||||||
'div',
|
|
||||||
{ class: 'navbar-content-container' },
|
|
||||||
slots.navbar?.({
|
|
||||||
toggleVerticalOverlayNavActive: toggleIsOverlayNavActive,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
])
|
|
||||||
|
|
||||||
const main = h(
|
|
||||||
'main',
|
|
||||||
{ class: 'layout-page-content' },
|
|
||||||
h(Transition, { name: 'fade-slide', mode: 'out-in', appear: true }, () =>
|
|
||||||
h('section', { class: 'page-content-container' }, slots.default?.()),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// 👉 根据路由 meta 决定 footer 高度
|
|
||||||
const shouldShowFooter = !route.meta.hideFooter
|
|
||||||
|
|
||||||
// 👉 Footer
|
|
||||||
const footer = h('footer', { class: 'layout-footer' }, [
|
|
||||||
h(
|
|
||||||
'div',
|
|
||||||
{
|
|
||||||
class: ['footer-content-container', !shouldShowFooter && 'footer-content-container-noheight'],
|
|
||||||
},
|
|
||||||
slots.footer?.(),
|
|
||||||
),
|
|
||||||
])
|
|
||||||
|
|
||||||
// 👉 Overlay
|
|
||||||
const layoutOverlay = h('div', {
|
|
||||||
class: ['layout-overlay', 'touch-none', { visible: isLayoutOverlayVisible.value }],
|
|
||||||
onClick: () => {
|
|
||||||
isLayoutOverlayVisible.value = !isLayoutOverlayVisible.value
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
return h(
|
|
||||||
'div',
|
|
||||||
{
|
|
||||||
class: [
|
|
||||||
'layout-wrapper layout-nav-type-vertical layout-navbar-static layout-footer-static layout-content-width-fluid',
|
|
||||||
'layout-navbar-fixed',
|
|
||||||
mdAndDown.value && 'layout-overlay-nav',
|
|
||||||
route.meta.layoutWrapperClasses,
|
|
||||||
scrollDistance.value && 'window-scrolled',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
[verticalNav, h('div', { class: 'layout-content-wrapper' }, [navbar, main, footer]), layoutOverlay],
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
@use '@configured-variables' as variables;
|
|
||||||
@use '@layouts/styles/placeholders';
|
|
||||||
@use '@layouts/styles/mixins';
|
|
||||||
|
|
||||||
.layout-wrapper.layout-nav-type-vertical {
|
|
||||||
// TODO(v2): Check why we need height in vertical nav & min-height in horizontal nav
|
|
||||||
block-size: 100%;
|
|
||||||
|
|
||||||
.layout-content-wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-grow: 1;
|
|
||||||
min-block-size: calc(var(--vh, 1vh) * 100);
|
|
||||||
transition: padding-inline-start 0.2s ease-in-out;
|
|
||||||
will-change: padding-inline-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-navbar {
|
|
||||||
position: fixed;
|
|
||||||
width: calc(100vw - variables.$layout-vertical-nav-width - 1rem);
|
|
||||||
z-index: variables.$layout-vertical-nav-layout-navbar-z-index;
|
|
||||||
inset-block-start: 0;
|
|
||||||
|
|
||||||
.navbar-content-container {
|
|
||||||
block-size: calc(env(safe-area-inset-top) + variables.$layout-vertical-nav-navbar-height);
|
|
||||||
}
|
|
||||||
|
|
||||||
@at-root {
|
|
||||||
.layout-wrapper.layout-nav-type-vertical {
|
|
||||||
.layout-navbar {
|
|
||||||
@if variables.$layout-vertical-nav-navbar-is-contained {
|
|
||||||
@include mixins.boxed-content;
|
|
||||||
} @else {
|
|
||||||
.navbar-content-container {
|
|
||||||
// @include mixins.boxed-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.layout-navbar-fixed .layout-navbar {
|
|
||||||
@extend %layout-navbar-fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.layout-navbar-hidden .layout-navbar {
|
|
||||||
@extend %layout-navbar-hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 👉 Footer
|
|
||||||
.layout-footer {
|
|
||||||
@include mixins.boxed-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 👉 Layout overlay
|
|
||||||
.layout-overlay {
|
|
||||||
position: fixed;
|
|
||||||
z-index: variables.$layout-overlay-z-index;
|
|
||||||
background-color: rgb(0 0 0 / 60%);
|
|
||||||
cursor: pointer;
|
|
||||||
inset: 0;
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
transition: opacity 0.25s ease-in-out;
|
|
||||||
will-change: transform;
|
|
||||||
|
|
||||||
&.visible {
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&:not(.layout-overlay-nav) .layout-content-wrapper {
|
|
||||||
padding-inline-start: variables.$layout-vertical-nav-width;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust right column pl when vertical nav is collapsed
|
|
||||||
&.layout-vertical-nav-collapsed .layout-content-wrapper {
|
|
||||||
padding-inline-start: variables.$layout-vertical-nav-collapsed-width;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 👉 Content height fixed
|
|
||||||
&.layout-content-height-fixed {
|
|
||||||
.layout-content-wrapper {
|
|
||||||
max-block-size: calc(var(--vh) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-page-content {
|
|
||||||
// display: flex;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
.page-content-container {
|
|
||||||
inline-size: 100%;
|
|
||||||
|
|
||||||
> :first-child {
|
|
||||||
max-block-size: 100%;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-wrapper.layout-nav-type-vertical.layout-overlay-nav {
|
|
||||||
.layout-navbar {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Reference in New Issue
Block a user