Module css in the header component

This commit is contained in:
kvakazyambra 2022-09-29 00:08:14 +03:00
parent f7ebc383f2
commit 53f71ce92f
3 changed files with 15 additions and 14 deletions

View File

@ -1,4 +1,4 @@
header { .mainHeader {
background: #fff; background: #fff;
margin-bottom: 2.2rem; margin-bottom: 2.2rem;
width: 100%; width: 100%;
@ -13,7 +13,7 @@ header {
} }
} }
.header--fixed { .headerFixed {
position: fixed; position: fixed;
top: 0; top: 0;
@ -26,7 +26,7 @@ header {
} }
} }
.header__inner { .headerInner {
background: #fff; background: #fff;
border-bottom: 4px solid #000; border-bottom: 4px solid #000;
flex-wrap: nowrap; flex-wrap: nowrap;
@ -48,7 +48,7 @@ header {
} }
} }
.main-logo { .mainLogo {
align-items: center; align-items: center;
display: inline-flex; display: inline-flex;
height: 70px; height: 70px;
@ -101,7 +101,7 @@ nav {
} }
} }
.main-navigation { .mainNavigation {
position: relative; position: relative;
@include font-size(1.7rem); @include font-size(1.7rem);
@ -264,7 +264,7 @@ nav {
} }
} }
.header__search { .headerSearch {
text-transform: lowercase; text-transform: lowercase;
.icon { .icon {

View File

@ -9,9 +9,10 @@ import { useModalStore, showModal, useWarningsStore } from '../../stores/ui'
import { useStore } from '@nanostores/solid' import { useStore } from '@nanostores/solid'
import { session as ssession } from '../../stores/auth' import { session as ssession } from '../../stores/auth'
import { handleClientRouteLinkClick, router, Routes, useRouter } from '../../stores/router' import { handleClientRouteLinkClick, router, Routes, useRouter } from '../../stores/router'
import './Header.scss' import styles from './Header.module.scss'
import { getPagePath } from '@nanostores/router' import { getPagePath } from '@nanostores/router'
import { getLogger } from '../../utils/logger' import { getLogger } from '../../utils/logger'
import { clsx } from 'clsx'
const log = getLogger('header') const log = getLogger('header')
@ -84,9 +85,9 @@ export const Header = (props: Props) => {
return ( return (
<header <header
class="main-header" class={styles.mainHeader}
classList={{ classList={{
['header--fixed']: props.isHeaderFixed, [styles.headerFixed]: props.isHeaderFixed,
['header--scrolled-top']: !getIsScrollingBottom() && getIsScrolled(), ['header--scrolled-top']: !getIsScrollingBottom() && getIsScrolled(),
['header--scrolled-bottom']: getIsScrollingBottom() && getIsScrolled() ['header--scrolled-bottom']: getIsScrollingBottom() && getIsScrolled()
}} }}
@ -95,13 +96,13 @@ export const Header = (props: Props) => {
<AuthModal /> <AuthModal />
</Modal> </Modal>
<div class="wide-container"> <div class="wide-container">
<nav class="row header__inner" classList={{ fixed: fixed() }}> <nav class={clsx(styles.headerInner, 'row')} classList={{ fixed: fixed() }}>
<div class="main-logo col-auto"> <div class={clsx(styles.mainLogo, 'col-auto')}>
<a href={getPagePath(router, 'home')} onClick={handleClientRouteLinkClick}> <a href={getPagePath(router, 'home')} onClick={handleClientRouteLinkClick}>
<img src="/logo.svg" alt={t('Discours')} /> <img src="/logo.svg" alt={t('Discours')} />
</a> </a>
</div> </div>
<div class="col main-navigation"> <div class={clsx(styles.mainNavigation, 'col')}>
<div class="article-header">{props.title}</div> <div class="article-header">{props.title}</div>
<ul class="col main-navigation text-xl inline-flex" classList={{ fixed: fixed() }}> <ul class="col main-navigation text-xl inline-flex" classList={{ fixed: fixed() }}>
@ -114,7 +115,7 @@ export const Header = (props: Props) => {
</li> </li>
)} )}
</For> </For>
<li class="header__search"> <li class={styles.headerSearch}>
<a href="#"> <a href="#">
<Icon name="search" /> <Icon name="search" />
{t('Search')} {t('Search')}

View File

@ -1,4 +1,4 @@
header { .main-header {
position: absolute; position: absolute;
} }