diff --git a/assets/less/classes/header.less b/assets/less/classes/header.less
index b0304961..e167c24a 100644
--- a/assets/less/classes/header.less
+++ b/assets/less/classes/header.less
@@ -1,6 +1,21 @@
.header {
- --header-height: 70px;
+ --header-image-px: 60px;
flex: 0 0 auto;
+ transition: height .2s;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ z-index: 500;
+
+ &--new {
+ position: fixed;
+ }
+
+ &--floating {
+ --header-height: var(--header-height-floating);
+ --header-image-px: 40px;
+ }
&__background {
position: absolute;
@@ -8,11 +23,11 @@
left: 0;
width: 100%;
height: 100%;
- mask-image: linear-gradient(0deg, transparent 0, var(--background-colour) var(--header-height));
- -webkit-mask-image: linear-gradient(0deg, transparent 0, var(--background-colour) var(--header-height));
background: var(--background-pattern);
background-color: var(--header-accent-colour);
background-blend-mode: multiply;
+ mask-image: linear-gradient(180deg, var(--background-colour) 0, transparent 100%);
+ -webkit-mask-image: linear-gradient(180deg, var(--background-colour) 0, transparent 100%);
}
&__wrapper {
@@ -62,9 +77,10 @@
cursor: pointer;
display: block;
background: url('/images/logos/imouto-default.png') no-repeat center / cover;
- width: 60px;
- height: 60px;
+ width: var(--header-image-px);
+ height: var(--header-image-px);
font-size: 0;
+ transition: width .2s, height .2s;
&--manage {
background-image: url('/images/logos/imouto-broom.png');
@@ -204,10 +220,10 @@
}
&__avatar {
- width: 60px;
- height: 60px;
+ width: var(--header-image-px);
+ height: var(--header-image-px);
margin-left: 5px;
- transition: box-shadow .2s;
+ transition: box-shadow .2s, width .2s, height .2s;
box-shadow: 0 0 4px #111;
&:hover,
@@ -226,14 +242,12 @@
color: inherit;
text-decoration: none;
font-size: 1.5em;
- line-height: 1.7em;
+ line-height: 32px;
width: 32px;
height: 32px;
- display: inline-flex;
- align-items: center;
- justify-content: center;
transition: background-color .2s;
border-radius: 4px;
+ text-align: center;
&:hover,
&:focus {
@@ -247,8 +261,21 @@
@media (max-width: @site-mobile-width) {
width: 40px;
height: 40px;
+ line-height: 40px;
font-size: 2em;
}
+
+ &__count {
+ position: absolute;
+ bottom: 1px;
+ right: 1px;
+ font-size: 10px;
+ background-color: var(--header-accent-colour);
+ opacity: .9;
+ border-radius: 4px;
+ line-height: 12px;
+ padding: 2px 4px;
+ }
}
}
}
diff --git a/assets/less/main.less b/assets/less/main.less
index ea054932..f76c7e2e 100644
--- a/assets/less/main.less
+++ b/assets/less/main.less
@@ -6,6 +6,8 @@
:root {
--site-max-width: 1200px;
+ --header-height: 70px;
+ --header-height-floating: 50px;
--background-image: initial;
@@ -65,6 +67,7 @@ html {
width: 100%;
margin: 0 auto;
flex: 1 0 auto;
+ padding-top: var(--header-height);
}
&--bg-blend {
diff --git a/assets/typescript/misuzu.ts b/assets/typescript/misuzu.ts
index ed2fadb5..6043ca6e 100644
--- a/assets/typescript/misuzu.ts
+++ b/assets/typescript/misuzu.ts
@@ -7,7 +7,6 @@
///
///
-
declare const timeago: any;
declare const hljs: any;
@@ -44,6 +43,20 @@ window.addEventListener('load', () => {
}
commentsInit();
+
+ const siteHeader: HTMLDivElement = document.querySelector('.js-header');
+
+ if (siteHeader) {
+ const siteHeaderFloating: string = 'header--floating';
+
+ window.addEventListener('scroll', () => {
+ if (scrollY > 0 && !siteHeader.classList.contains(siteHeaderFloating)) {
+ siteHeader.classList.add(siteHeaderFloating);
+ } else if (scrollY <= 1 && siteHeader.classList.contains(siteHeaderFloating)) {
+ siteHeader.classList.remove(siteHeaderFloating);
+ }
+ });
+ }
});
function loginFormUpdateAvatar(avatarElement: HTMLElement, usernameElement: HTMLInputElement, force: boolean = false): void {
diff --git a/templates/_layout/header-old.twig b/templates/_layout/header-old.twig
new file mode 100644
index 00000000..9cceb620
--- /dev/null
+++ b/templates/_layout/header-old.twig
@@ -0,0 +1,89 @@
+{% from '_layout/input.twig' import input_checkbox_raw %}
+{% set in_manage = manage_menu is defined %}
+
+
diff --git a/templates/_layout/header.twig b/templates/_layout/header.twig
index 9cceb620..e254a238 100644
--- a/templates/_layout/header.twig
+++ b/templates/_layout/header.twig
@@ -1,7 +1,8 @@
{% from '_layout/input.twig' import input_checkbox_raw %}
{% set in_manage = manage_menu is defined %}
-