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

281 lines
4.9 KiB
Stylus
Raw Normal View History

$header-progress-height = 2.8px;
.header-wrapper {
width: 100%;
height: 100%;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
background: var(--background-color);
padding-top: $header-progress-height;
2020-11-13 14:43:22 +08:00
hover-style(1.02, 1.02);
.header-content {
2020-11-15 22:06:32 +08:00
position: relative;
2020-09-03 16:47:52 +08:00
height: 100%;
2020-11-15 22:06:32 +08:00
width: $main-content-width;
2020-11-25 23:39:24 +08:00
max-width: $content-max-width;
2020-11-15 22:06:32 +08:00
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
z-index: $z-index-5;
2020-09-03 16:47:52 +08:00
transition();
2020-11-20 12:02:22 +08:00
+keep-tablet() {
width: $main-content-width-tablet !important;
2020-09-03 16:47:52 +08:00
}
2020-11-20 12:02:22 +08:00
+keep-mobile() {
width: $main-content-width-mobile !important;
2020-09-03 16:47:52 +08:00
}
.logo-title {
font-size: 2.2em;
font-weight: bold;
2020-06-04 22:11:27 +08:00
2020-11-20 12:02:22 +08:00
+keep-tablet() {
2020-06-04 22:11:27 +08:00
font-size: 2.0em;
}
2020-11-20 12:02:22 +08:00
+keep-mobile() {
2020-06-04 22:11:27 +08:00
font-size: 1.8em;
}
2020-04-01 22:42:24 +08:00
letter-spacing: 1px;
color: var(--first-text-color);
transition();
}
2020-11-15 22:06:32 +08:00
.menu-list {
2020-11-20 12:02:22 +08:00
+keep-tablet() {
2020-09-03 16:47:52 +08:00
display: none;
}
.menu-item {
float: left;
position: relative;
margin-left: 30px;
&:first-child {
margin-left: 0;
}
a {
&:hover {
2020-11-18 11:56:47 +08:00
color: var(--default-text-color);
2020-04-01 22:42:24 +08:00
&::after {
content: '';
position: absolute;
bottom: -10px;
left: 50%;
width: 100%;
height: 2px;
transform: translateX(-50%);
background: var(--primary-color);
transition();
}
}
}
.active {
color: var(--second-text-color);
2020-04-01 22:42:24 +08:00
font-weight: bold;
transition();
&::after {
content: '';
position: absolute;
bottom: -10px;
left: 50%;
width: 100%;
height: 2px;
transform: translateX(-50%);
background: var(--primary-color)
transition();
}
}
}
}
.menu-bar {
display: none;
2020-04-01 22:42:24 +08:00
position: relative;
cursor: pointer;
2020-11-20 12:02:22 +08:00
+keep-tablet() {
2020-09-03 16:47:52 +08:00
display: block;
}
2020-04-01 22:42:24 +08:00
.menu-bar-middle {
width: 18px;
height: 2px;
margin: 6px 0;
position: relative;
2020-11-18 11:56:47 +08:00
background: var(--default-text-color);
transition();
2020-04-01 22:42:24 +08:00
&::before {
content: '';
position: absolute;
top: -6px;
left: 0;
width: 100%;
height: 2px;
2020-11-18 11:56:47 +08:00
background: var(--default-text-color);
transition();
2020-04-01 22:42:24 +08:00
}
&::after {
content: '';
position: absolute;
bottom: -6px;
left: 0;
width: 100%;
height: 2px;
2020-11-18 11:56:47 +08:00
background: var(--default-text-color);
transition();
2020-04-01 22:42:24 +08:00
}
}
}
}
.header-drawer {
width: 100%;
2020-04-01 12:09:06 +08:00
padding: $header-height 0 20px 0;
position: absolute;
top: 0;
left: 0;
transform: scaleY(0);
transform-origin: top;
background: var(--background-color);
transition();
2020-04-01 22:42:24 +08:00
z-index: $z-index-2;
.drawer-menu-list {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
.drawer-menu-item {
2020-04-01 22:42:24 +08:00
a {
display: block;
margin: 8px auto;
padding: 0 20px;
border-radius: 20px;
text-align: center;
line-height: 34px;
2020-11-18 11:56:47 +08:00
color: var(--default-text-color);
transition();
2020-04-01 22:42:24 +08:00
&:hover {
color: var(--second-text-color);
2020-04-01 22:42:24 +08:00
font-weight: bold;
}
}
.active {
2020-11-18 11:56:47 +08:00
border: 1px solid var(--default-text-color);
color: var(--second-text-color);
2020-04-01 22:42:24 +08:00
font-weight: bold;
}
}
}
}
.window-mask {
position: absolute;
top: 0;
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
2020-04-01 22:42:24 +08:00
z-index: $z-index-1;
visibility: hidden;
opacity: 0;
transition();
}
}
.header-drawer-show {
opacity: 1 !important;
2020-04-01 22:42:24 +08:00
.header-content {
.menu-bar {
.menu-bar-middle {
2020-04-01 22:42:24 +08:00
background: transparent;
&::before {
transform: translateY(6px) rotate(45deg);
}
2020-04-01 22:42:24 +08:00
&::after {
transform: translateY(-6px) rotate(-45deg);
}
}
}
}
.header-drawer {
transform: scaleY(1);
}
.window-mask {
visibility: visible;
opacity: 1;
}
}
.header-wrapper-shrink {
2020-04-28 23:20:17 +08:00
.header-content {
2020-04-01 22:42:24 +08:00
.logo-title {
transform: scale(0.8);
transform-origin: left top;
2020-04-01 22:42:24 +08:00
}
.menu-list {
.menu-item {
a:hover {
&::after {
2020-11-16 19:04:24 +08:00
bottom: -($header-shrink-height / 2 - 12);
}
}
.active::after {
2020-11-16 19:04:24 +08:00
bottom: -($header-shrink-height / 2 - 12);
}
}
}
}
.header-drawer {
2020-04-01 12:09:06 +08:00
padding: $header-shrink-height 0 20px 0;
}
2020-07-09 18:25:20 +08:00
}