Subnavigation fix

This commit is contained in:
kvakazyambra 2023-08-29 01:15:31 +03:00
parent 2ccdda19c4
commit 442d8d4504
3 changed files with 69 additions and 21 deletions

View File

@ -512,18 +512,25 @@
} }
.subnavigation { .subnavigation {
background: #fff; background: #000;
color: #fff;
font-weight: 500; font-weight: 500;
left: 0; left: 0;
position: absolute; position: absolute;
top: 100%; top: 100%;
transform: translateY(-2px);
width: 100%; width: 100%;
@include media-breakpoint-down(md) {
display: none;
}
ul { ul {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
height: 6rem; height: 6rem;
line-height: 6rem; line-height: 6rem;
margin-bottom: 0;
padding: 0 150px 0 0; padding: 0 150px 0 0;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
@ -548,31 +555,33 @@
a:link, a:link,
a:visited { a:visited {
border: none; border: none;
color: #fff;
.icon {
filter: invert(1);
}
&:hover { &:hover {
.subnavigationItemName { opacity: 0.5;
background: #000;
}
.icon {
filter: invert(1);
}
} }
} }
} }
.subnavigationItemName { .subnavigationItemName {
align-items: center; align-items: center;
background: #fff;
display: flex; display: flex;
transition: background-color 0.3s; transition: background-color 0.3s;
.subnavigationFeed & { .subnavigationFeed & {
line-height: 1.4; line-height: 60px;
} }
} }
.subnavigationFeed { .subnavigationFeed {
ul {
padding-right: 0;
}
li { li {
align-items: center; align-items: center;
display: flex; display: flex;

View File

@ -111,11 +111,27 @@ export const Header = (props: Props) => {
} }
const toggleSubnavigation = (isShow, signal) => { const toggleSubnavigation = (isShow, signal) => {
clearTimer()
setIsKnowledgeBaseVisible(false) setIsKnowledgeBaseVisible(false)
setIsTopicsVisible(false) setIsTopicsVisible(false)
setIsZineVisible(false) setIsZineVisible(false)
setIsFeedVisible(false) setIsFeedVisible(false)
signal(isShow)
if (signal) {
signal(isShow)
}
}
let timer = 0
const clearTimer = () => {
clearTimeout(timer)
}
const hideSubnavigation = () => {
timer = setTimeout(() => {
toggleSubnavigation(false)
}, 500)
} }
return ( return (
@ -144,14 +160,15 @@ 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('col offset-xl-1', styles.mainNavigationWrapper)}> <div class={clsx('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
onmouseover={() => toggleSubnavigation(true, setIsZineVisible)} onMouseOver={() => toggleSubnavigation(true, setIsZineVisible)}
onMouseOut={hideSubnavigation}
href={getPagePath(router, 'home')} href={getPagePath(router, 'home')}
> >
{t('zine')} {t('zine')}
@ -159,7 +176,8 @@ 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
onmouseover={() => toggleSubnavigation(true, setIsFeedVisible)} onMouseOver={() => toggleSubnavigation(true, setIsFeedVisible)}
onMouseOut={hideSubnavigation}
href={getPagePath(router, 'feed')} href={getPagePath(router, 'feed')}
> >
{t('feed')} {t('feed')}
@ -167,7 +185,8 @@ 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
onmouseover={() => toggleSubnavigation(true, setIsTopicsVisible)} onMouseOver={() => toggleSubnavigation(true, setIsTopicsVisible)}
onMouseOut={hideSubnavigation}
href={getPagePath(router, 'topics')} href={getPagePath(router, 'topics')}
> >
{t('topics')} {t('topics')}
@ -177,7 +196,10 @@ export const Header = (props: Props) => {
<a href={getPagePath(router, 'authors')}>{t('community')}</a> <a href={getPagePath(router, 'authors')}>{t('community')}</a>
</li> </li>
<li> <li>
<a onmouseover={() => toggleSubnavigation(true, setIsKnowledgeBaseVisible)}> <a
onMouseOver={() => toggleSubnavigation(true, setIsKnowledgeBaseVisible)}
onMouseOut={hideSubnavigation}
>
{t('Knowledge base')} {t('Knowledge base')}
</a> </a>
</li> </li>
@ -222,7 +244,12 @@ export const Header = (props: Props) => {
</div> </div>
</div> </div>
<div class={clsx(styles.subnavigation, 'col')} classList={{ hidden: !isKnowledgeBaseVisible() }}> <div
class={clsx(styles.subnavigation, 'col')}
classList={{ hidden: !isKnowledgeBaseVisible() }}
onMouseOver={clearTimer}
onMouseOut={hideSubnavigation}
>
<ul class="nodash"> <ul class="nodash">
<li> <li>
<a href="/about/manifest">Манифест</a> <a href="/about/manifest">Манифест</a>
@ -257,7 +284,12 @@ export const Header = (props: Props) => {
</ul> </ul>
</div> </div>
<div class={clsx(styles.subnavigation, 'col')} classList={{ hidden: !isZineVisible() }}> <div
class={clsx(styles.subnavigation, 'col')}
classList={{ hidden: !isZineVisible() }}
onMouseOver={clearTimer}
onMouseOut={hideSubnavigation}
>
<ul class="nodash"> <ul class="nodash">
<li> <li>
<a href="">Искусство</a> <a href="">Искусство</a>
@ -298,7 +330,12 @@ export const Header = (props: Props) => {
</ul> </ul>
</div> </div>
<div class={clsx(styles.subnavigation, 'col')} classList={{ hidden: !isTopicsVisible() }}> <div
class={clsx(styles.subnavigation, 'col')}
classList={{ hidden: !isTopicsVisible() }}
onMouseOver={clearTimer}
onMouseOut={hideSubnavigation}
>
<ul class="nodash"> <ul class="nodash">
<li> <li>
<a href="">#Интервью</a> <a href="">#Интервью</a>
@ -330,6 +367,8 @@ export const Header = (props: Props) => {
<div <div
class={clsx(styles.subnavigation, styles.subnavigationFeed, 'col')} class={clsx(styles.subnavigation, styles.subnavigationFeed, 'col')}
classList={{ hidden: !isFeedVisible() }} classList={{ hidden: !isFeedVisible() }}
onMouseOver={clearTimer}
onMouseOut={hideSubnavigation}
> >
<ul class="nodash"> <ul class="nodash">
<li> <li>

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, 'col')}> <div class={clsx(styles.usernav)}>
<div class={clsx(styles.userControl, styles.userControl, 'col')}> <div class={clsx(styles.userControl, 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')}>