hexo-theme-keep/source/css/layout/_partial/header.styl

276 lines
5.4 KiB
Stylus

$logo-title-font-size = 2.2rem;
$pc-search-icon-font-size = 1.5rem;
$menu-bar-line-height = 2.5px;
.header-wrapper {
width: 100%;
height: 100%;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
background: var(--background-color);
padding-top: $scroll-progress-bar-height;
transition();
hover-style(1.02, 1.02);
.header-content {
position: relative;
height: 100%;
width: $main-content-width;
max-width: $content-max-width;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
z-index: $z-index-5;
transition();
&.has-first-screen {
max-width: $content-max-width * 1.2;
}
+keep-tablet() {
width: $main-content-width-tablet;
}
+keep-mobile() {
width: $main-content-width-mobile;
}
.left {
display: flex;
align-items: center;
transition();
.header-shrink & {
transform: scale(0.85);
transform-origin: left;
transition();
}
.logo-title {
font-size: $logo-title-font-size;
font-weight: bold;
letter-spacing: 1px;
color: var(--first-text-color);
transition();
+keep-tablet() {
font-size: $logo-title-font-size * 0.9;
}
+keep-mobile() {
font-size: $logo-title-font-size * 0.8;
}
}
}
.right {
.pc {
.menu-list {
display: flex;
align-items: center;
+keep-tablet() {
display: none;
}
.menu-item {
float: left;
position: relative;
margin-left: 30px;
font-size: 1rem;
cursor: pointer;
&:first-child {
margin-left: 0;
}
a:hover, .active {
&::after {
transition();
content: '';
position: absolute;
bottom: -10px;
left: 50%;
width: 100%;
height: 2px;
transform: translateX(-50%);
background: var(--primary-color);
.header-shrink & {
transition();
bottom: -($header-shrink-height / 2 - 12);
}
}
}
&.search {
font-size: $pc-search-icon-font-size;
margin-left: 26px;
}
}
}
}
.mobile {
display: flex;
justify-content: space-between;
align-items: center;
.icon-item {
display: none;
position: relative;
cursor: pointer;
font-size: 18px;
margin-left: 12px;
width: 20px;
height: 20px;
&:first-child {
margin-left: 0;
}
+keep-tablet() {
display: flex;
justify-content: center;
align-items: center;
}
}
.menu-bar {
.menu-bar-middle {
width: 18px;
height: $menu-bar-line-height;
position: relative;
background: var(--default-text-color);
transition();
.header-drawer-show & {
transition();
background: transparent;
}
&::before, &::after {
content: '';
position: absolute;
left: 0;
width: 100%;
height: $menu-bar-line-height;
background: var(--default-text-color);
transition();
}
&::before {
top: -6px;
.header-drawer-show & {
transform: translateY(6px) rotate(45deg);
}
}
&::after {
bottom: -6px;
.header-drawer-show & {
transform: translateY(-6px) rotate(-45deg);
}
}
}
}
}
}
}
.header-drawer {
width: 100%;
padding: $header-height 0 20px 0;
position: absolute;
top: 0;
left: 0;
transform: scaleY(0);
transform-origin: top;
background: var(--background-color);
z-index: $z-index-2;
transition();
.header-drawer-show & {
transition();
transform: scaleY(1);
}
.drawer-menu-list {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
.drawer-menu-item {
font-size: 1rem;
margin: 6px 0;
height: 38px;
a {
padding: 6px 20px;
border-radius: 20px;
color: var(--default-text-color);
transition();
&:hover {
color: var(--second-text-color);
border: 1px solid var(--default-text-color);
}
&.active {
border: 1px solid var(--default-text-color);
color: var(--second-text-color);
}
}
}
}
}
.window-mask {
position: absolute;
top: 0;
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
z-index: $z-index-1;
visibility: hidden;
opacity: 0;
transition();
.header-drawer-show & {
visibility: visible;
opacity: 1;
transition();
}
}
}
.header-drawer-show {
overflow: hidden;
}