Allow column width configuration: allow stretching navbar with columns

This commit is contained in:
Alexander Tumin 2022-08-17 02:33:39 +03:00
parent 258b5e6be2
commit a29835375a
7 changed files with 46 additions and 8 deletions

View File

@ -60,6 +60,13 @@ export default {
'-' + this.layoutType
]
},
navClasses () {
const { navbarColumnStretch } = this.$store.getters.mergedConfig
return [
'-' + this.layoutType,
...(navbarColumnStretch ? ['-column-stretch'] : [])
]
},
currentUser () { return this.$store.state.users.currentUser },
userBackground () { return this.currentUser.background_image },
instanceBackground () {

View File

@ -185,13 +185,14 @@ nav {
--maxiColumn: 45rem;
--columnGap: 1em;
--status-margin: 0.75em;
--effectiveSidebarColumnWidth: minmax(var(--miniColumn), var(--sidebarColumnWidth, var(--miniColumn)));
--effectiveNotifsColumnWidth: minmax(var(--miniColumn), var(--notifsColumnWidth, var(--miniColumn)));
--effectiveContentColumnWidth: minmax(var(--miniColumn), var(--contentColumnWidth, var(--maxiColumn)));
position: relative;
display: grid;
grid-template-columns:
minmax(var(--miniColumn), var(--sidebarColumnWidth, var(--miniColumn)))
var(--effectiveSidebarColumnWidth)
var(--effectiveContentColumnWidth);
grid-template-areas: "sidebar content";
grid-template-rows: 1fr;
@ -288,22 +289,22 @@ nav {
&.-reverse:not(.-wide):not(.-mobile) {
grid-template-columns:
var(--effectiveContentColumnWidth)
minmax(var(--miniColumn), var(--sidebarColumnWidth, var(--miniColumn)));
var(--effectiveSidebarColumnWidth);
grid-template-areas: "content sidebar";
}
&.-wide {
grid-template-columns:
minmax(var(--miniColumn), var(--sidebarColumnWidth, var(--miniColumn)))
var(--effectiveSidebarColumnWidth)
var(--effectiveContentColumnWidth)
minmax(var(--miniColumn), var(--notifsColumnWidth, var(--miniColumn)));
var(--effectiveNotifsColumnWidth);
grid-template-areas: "sidebar content notifs";
&.-reverse {
grid-template-columns:
minmax(var(--miniColumn), var(--notifsColumnWidth, var(--miniColumn)))
var(--effectiveNotifsColumnWidth)
var(--effectiveContentColumnWidth)
minmax(var(--miniColumn), var(--sidebarColumnWidth, var(--miniColumn)));
var(--effectiveSidebarColumnWidth);
grid-template-areas: "notifs content sidebar";
}
}

View File

@ -8,7 +8,10 @@
class="app-bg-wrapper"
/>
<MobileNav v-if="layoutType === 'mobile'" />
<DesktopNav v-else />
<DesktopNav
v-else
:class="navClasses"
/>
<Notifications v-if="currentUser" />
<div
id="content"

View File

@ -23,6 +23,26 @@
max-width: 980px;
}
&.-column-stretch .inner-nav {
--miniColumn: 25rem;
--maxiColumn: 45rem;
--columnGap: 1em;
max-width: calc(
var(--sidebarColumnWidth, var(--miniColumn)) +
var(--contentColumnWidth, var(--maxiColumn)) +
var(--columnGap)
);
}
&.-column-stretch.-wide .inner-nav {
max-width: calc(
var(--sidebarColumnWidth, var(--miniColumn)) +
var(--contentColumnWidth, var(--maxiColumn)) +
var(--notifsColumnWidth, var(--miniColumn)) +
var(--columnGap)
);
}
&.-logoLeft .inner-nav {
grid-template-columns: auto 2fr 2fr;
grid-template-areas: "logo sitename actions";

View File

@ -122,6 +122,11 @@
{{ $t('settings.right_sidebar') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="navbarColumnStretch">
{{ $t('settings.navbar_column_stretch') }}
</BooleanSetting>
</li>
<li>
<ChoiceSetting
v-if="user"

View File

@ -412,6 +412,7 @@
"hide_isp": "Hide instance-specific panel",
"hide_shoutbox": "Hide instance shoutbox",
"right_sidebar": "Reverse order of columns",
"navbar_column_stretch": "Stretch navbar to columns width",
"always_show_post_button": "Always show floating New Post button",
"hide_wallpaper": "Hide instance wallpaper",
"preload_images": "Preload images",

View File

@ -87,6 +87,7 @@ export const defaultState = {
sidebarColumnWidth: '25rem',
contentColumnWidth: '45rem',
notifsColumnWidth: '25rem',
navbarColumnStretch: false,
listsNavigation: false,
greentext: undefined, // instance default
useAtIcon: undefined, // instance default