Main navigation fixes

This commit is contained in:
kvakazyambra 2023-09-04 23:45:02 +03:00
parent efb0904848
commit b004e34e67
4 changed files with 43 additions and 24 deletions

View File

@ -95,12 +95,11 @@
.usernav { .usernav {
display: inline-flex; display: inline-flex;
flex: 0 0 40% !important;
font-weight: 500; font-weight: 500;
max-width: 400px !important; justify-content: end;
position: relative; position: relative;
@include media-breakpoint-down(md) { @include media-breakpoint-down(lg) {
flex: 1 !important; flex: 1 !important;
max-width: 100% !important; max-width: 100% !important;
padding: 0 !important; padding: 0 !important;
@ -111,7 +110,7 @@
@include font-size(1.7rem); @include font-size(1.7rem);
position: relative; position: relative;
@include media-breakpoint-down(md) { @include media-breakpoint-down(lg) {
display: none; display: none;
} }
@ -122,18 +121,10 @@
.mainNavigation { .mainNavigation {
font-size: 1.4rem !important; font-size: 1.4rem !important;
margin: 0 !important; margin: 0 0 0 -0.4rem !important;
opacity: 1; opacity: 1;
transition: opacity 0.3s; transition: opacity 0.3s;
li {
margin-bottom: 0 !important;
&:first-letter {
text-transform: capitalize;
}
}
@include media-breakpoint-down(md) { @include media-breakpoint-down(md) {
background: var(--background-color); background: var(--background-color);
bottom: 0; bottom: 0;
@ -166,6 +157,24 @@
} }
} }
} }
a,
button {
padding: 0 0.4rem;
}
li {
margin-bottom: 0 !important;
&:first-letter {
text-transform: capitalize;
}
}
}
.mainNavigationItemActive {
background: #000;
color: #fff !important;
} }
.headerWithTitle.headerScrolledBottom { .headerWithTitle.headerScrolledBottom {
@ -185,7 +194,7 @@
padding-left: divide($container-padding-x, 2); padding-left: divide($container-padding-x, 2);
} }
@include media-breakpoint-up(md) { @include media-breakpoint-up(lg) {
display: none; display: none;
} }
} }
@ -302,7 +311,7 @@
transform: translateY(-50%); transform: translateY(-50%);
width: 100%; width: 100%;
@include media-breakpoint-up(md) { @include media-breakpoint-up(lg) {
right: 0; right: 0;
} }
@ -464,7 +473,7 @@
} }
} }
@include media-breakpoint-up(lg) { @include media-breakpoint-up(xl) {
margin-left: 0.5em !important; margin-left: 0.5em !important;
margin-right: 0.5em; margin-right: 0.5em;
width: auto; width: auto;
@ -475,9 +484,10 @@
.textLabel { .textLabel {
color: var(--link-color); color: var(--link-color);
padding: 0;
display: inline; display: inline;
padding: 0;
position: relative; position: relative;
white-space: nowrap;
z-index: 1; z-index: 1;
} }
} }

View File

@ -128,10 +128,10 @@ export const Header = (props: Props) => {
clearTimeout(timer) clearTimeout(timer)
} }
const hideSubnavigation = () => { const hideSubnavigation = (ev, time = 500) => {
timer = setTimeout(() => { timer = setTimeout(() => {
toggleSubnavigation(false) toggleSubnavigation(false)
}, 500) }, time)
} }
return ( return (
@ -160,13 +160,14 @@ export const Header = (props: Props) => {
<img src="/logo.svg" alt={t('Discours')} /> <img src="/logo.svg" alt={t('Discours')} />
</a> </a>
</div> </div>
<div class={clsx('offset-xl-1', styles.mainNavigationWrapper)}> <div class={clsx('col col-md-13 col-lg-12 offset-xl-1', styles.mainNavigationWrapper)}>
<Show when={props.title}> <Show when={props.title}>
<div class={styles.articleHeader}>{props.title}</div> <div class={styles.articleHeader}>{props.title}</div>
</Show> </Show>
<ul class={clsx('view-switcher', styles.mainNavigation)} classList={{ fixed: fixed() }}> <ul class={clsx('view-switcher', styles.mainNavigation)} classList={{ fixed: fixed() }}>
<li classList={{ 'view-switcher__item--selected': page().route === 'home' }}> <li classList={{ 'view-switcher__item--selected': page().route === 'home' }}>
<a <a
classList={{ [styles.mainNavigationItemActive]: isZineVisible() }}
onMouseOver={() => toggleSubnavigation(true, setIsZineVisible)} onMouseOver={() => toggleSubnavigation(true, setIsZineVisible)}
onMouseOut={hideSubnavigation} onMouseOut={hideSubnavigation}
href={getPagePath(router, 'home')} href={getPagePath(router, 'home')}
@ -176,6 +177,7 @@ export const Header = (props: Props) => {
</li> </li>
<li classList={{ 'view-switcher__item--selected': page().route.startsWith('feed') }}> <li classList={{ 'view-switcher__item--selected': page().route.startsWith('feed') }}>
<a <a
classList={{ [styles.mainNavigationItemActive]: isFeedVisible() }}
onMouseOver={() => toggleSubnavigation(true, setIsFeedVisible)} onMouseOver={() => toggleSubnavigation(true, setIsFeedVisible)}
onMouseOut={hideSubnavigation} onMouseOut={hideSubnavigation}
href={getPagePath(router, 'feed')} href={getPagePath(router, 'feed')}
@ -185,6 +187,7 @@ export const Header = (props: Props) => {
</li> </li>
<li classList={{ 'view-switcher__item--selected': page().route === 'topics' }}> <li classList={{ 'view-switcher__item--selected': page().route === 'topics' }}>
<a <a
classList={{ [styles.mainNavigationItemActive]: isTopicsVisible() }}
onMouseOver={() => toggleSubnavigation(true, setIsTopicsVisible)} onMouseOver={() => toggleSubnavigation(true, setIsTopicsVisible)}
onMouseOut={hideSubnavigation} onMouseOut={hideSubnavigation}
href={getPagePath(router, 'topics')} href={getPagePath(router, 'topics')}
@ -193,10 +196,17 @@ export const Header = (props: Props) => {
</a> </a>
</li> </li>
<li classList={{ 'view-switcher__item--selected': page().route === 'authors' }}> <li classList={{ 'view-switcher__item--selected': page().route === 'authors' }}>
<a href={getPagePath(router, 'authors')}>{t('community')}</a> <a
onMouseOver={(ev) => hideSubnavigation(ev, 0)}
onMouseOut={(ev) => hideSubnavigation(ev, 0)}
href={getPagePath(router, 'authors')}
>
{t('community')}
</a>
</li> </li>
<li> <li>
<a <a
classList={{ [styles.mainNavigationItemActive]: isKnowledgeBaseVisible() }}
onMouseOver={() => toggleSubnavigation(true, setIsKnowledgeBaseVisible)} onMouseOver={() => toggleSubnavigation(true, setIsKnowledgeBaseVisible)}
onMouseOut={hideSubnavigation} onMouseOut={hideSubnavigation}
> >

View File

@ -107,8 +107,8 @@ export const HeaderAuth = (props: Props) => {
return ( return (
<ShowOnlyOnClient> <ShowOnlyOnClient>
<Show when={isSessionLoaded()} keyed={true}> <Show when={isSessionLoaded()} keyed={true}>
<div class={clsx(styles.usernav)}> <div class={clsx('col-sm-6 col-lg-7', styles.usernav)}>
<div class={clsx(styles.userControl, styles.userControl)}> <div class={styles.userControl}>
<Show when={showCreatePostButton()}> <Show when={showCreatePostButton()}>
<div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}> <div class={clsx(styles.userControlItem, styles.userControlItemVerbose)}>
<a href={getPagePath(router, 'create')}> <a href={getPagePath(router, 'create')}>

View File

@ -577,7 +577,6 @@ figure {
.view-switcher { .view-switcher {
@include font-size(1.4rem); @include font-size(1.4rem);
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
font-weight: 500; font-weight: 500;