cullmann.io/themes/CodeIT/assets/css/_partial/_header.scss

474 lines
8.5 KiB
SCSS
Raw Normal View History

2021-02-18 21:44:01 +01:00
header {
width: 100%;
z-index: 150;
background-color: $header-background-color;
@include transition(box-shadow 0.3s ease);
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background-color: $header-background-color-dark;
}
.logo {
min-height: 1.5em;
height: 1.5em;
vertical-align: text-bottom;
}
2021-02-18 22:21:36 +01:00
.logo,
.header-title-pre {
padding-right: 0.25rem;
2021-02-18 21:44:01 +01:00
}
.header-title-post {
2021-02-18 22:21:36 +01:00
padding-left: 0.25rem;
2021-02-18 21:44:01 +01:00
}
&:hover {
2021-02-18 22:21:36 +01:00
@include box-shadow(0 0 1.5rem 0 rgba(0, 0, 0, 0.1));
2021-02-18 21:44:01 +01:00
}
}
.header-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
width: 100%;
}
.header-title {
font-family: $header-title-font-family;
font-weight: bold;
2021-02-18 22:21:36 +01:00
margin-right: 0.5rem;
2021-02-18 21:44:01 +01:00
min-width: 10%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
@include flex(10);
}
.menu .menu-item {
position: relative;
}
.language-select {
position: absolute;
opacity: 0;
left: 0;
top: 0;
width: 100%;
height: 100%;
&:hover {
cursor: pointer;
}
}
.search {
position: relative;
input {
color: transparent;
box-sizing: border-box;
height: 2.5rem;
width: 2.5rem;
2021-02-18 22:21:36 +01:00
@include border-radius(0.5rem);
2021-02-18 21:44:01 +01:00
border: none;
outline: none;
background-color: $header-background-color;
vertical-align: baseline !important;
@include transition(width 0.3s ease);
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background-color: $header-background-color-dark;
}
}
@include placeholder(transparent);
.search-button {
margin: 0;
position: absolute;
left: auto;
right: 1rem;
}
.search-toggle {
2021-02-18 22:21:36 +01:00
left: 0.5rem;
2021-02-18 21:44:01 +01:00
right: auto;
top: -1.125rem;
bottom: -1.125rem;
2021-02-18 21:44:01 +01:00
}
.search-loading {
display: none;
}
.search-clear {
display: none;
}
2021-02-18 22:21:36 +01:00
.open &,
&.mobile {
2021-02-18 21:44:01 +01:00
input {
color: $global-font-color;
background-color: $search-background-color;
padding: 0 2rem 0 2rem;
}
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
input {
color: $global-font-color-dark;
background-color: $search-background-color-dark;
}
@include placeholder($global-font-secondary-color-dark);
}
@include placeholder($global-font-secondary-color);
.search-button {
color: $global-font-secondary-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
color: $global-font-secondary-color-dark;
}
}
.search-clear:hover {
color: #ff6b6b;
}
.search-toggle:hover {
cursor: default;
}
}
}
.theme-switch i {
@include transform(rotate(225deg));
}
#header-desktop {
display: block;
position: fixed;
height: $header-height;
line-height: $header-height;
2021-02-18 22:21:36 +01:00
[header-desktop="normal"] & {
2021-02-18 21:44:01 +01:00
position: static;
}
.header-wrapper {
padding: 0 2rem 0 10vh;
.header-title {
font-size: $header-title-font-size;
}
.menu {
overflow: hidden;
white-space: nowrap;
.menu-inner {
float: right;
}
.menu-item {
2021-02-18 22:21:36 +01:00
margin: 0 0.5rem;
2021-02-18 21:44:01 +01:00
&.delimiter {
border-left: 1.5px solid $global-font-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
border-left-color: $global-border-color-dark;
}
}
&.language {
margin-right: 0;
}
&.search {
2021-02-18 22:21:36 +01:00
margin: 0 -0.5rem 0 0;
2021-02-18 21:44:01 +01:00
}
}
a.active {
font-weight: 900;
color: $header-hover-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
color: $header-hover-color-dark;
}
}
}
}
&.open .header-wrapper .menu .menu-item.search {
2021-02-18 22:21:36 +01:00
margin: 0 0.25rem 0 0.5rem;
2021-02-18 21:44:01 +01:00
input {
width: 24rem;
}
}
}
#header-mobile {
display: none;
position: fixed;
height: $header-height;
line-height: $header-height;
2021-02-18 22:21:36 +01:00
[header-mobile="normal"] & {
2021-02-18 21:44:01 +01:00
position: static;
}
.header-container {
padding: 0;
margin: 0;
.header-wrapper {
padding: 0 1rem;
font-size: 1.125rem;
@include transition(margin-top 0.3s ease);
.header-title {
font-size: $header-title-font-size;
max-width: 80%;
}
.menu-toggle {
line-height: 4rem;
cursor: pointer;
@include transition(width 0.3s ease);
span {
display: block;
background: $global-font-color;
width: 1.5rem;
height: 2px;
@include border-radius(3px);
@include transition(all 0.3s ease-in-out);
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background: $global-font-color-dark;
}
}
span:nth-child(1) {
2021-02-18 22:21:36 +01:00
margin-bottom: 0.5rem;
2021-02-18 21:44:01 +01:00
}
span:nth-child(3) {
2021-02-18 22:21:36 +01:00
margin-top: 0.5rem;
2021-02-18 21:44:01 +01:00
}
&.active {
span:nth-child(1) {
2021-02-18 22:21:36 +01:00
@include transform(rotate(45deg) translate(0.4rem, 0.5rem));
2021-02-18 21:44:01 +01:00
}
span:nth-child(2) {
2021-02-18 22:21:36 +01:00
opacity: 0;
2021-02-18 21:44:01 +01:00
}
span:nth-child(3) {
2021-02-18 22:21:36 +01:00
@include transform(rotate(-45deg) translate(0.4rem, -0.5rem));
2021-02-18 21:44:01 +01:00
}
}
}
}
.menu {
text-align: center;
background: $header-background-color;
border-top: 2px solid $global-border-color;
display: none;
2021-02-18 22:21:36 +01:00
padding-top: 0.5rem;
@include box-shadow(0 0.125rem 0.25rem rgba(0, 0, 0, 0.1));
2021-02-18 21:44:01 +01:00
.search-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
padding: ($header-height - 2.5rem) / 2 1rem;
line-height: 2.5rem;
}
.search {
flex-grow: 10;
2021-02-18 22:21:36 +01:00
.algolia-autocomplete,
input {
2021-02-18 21:44:01 +01:00
width: 100%;
}
}
.search-button {
top: 0;
}
.search-cancel {
display: none;
2021-02-18 22:21:36 +01:00
margin-left: 0.75rem;
2021-02-18 21:44:01 +01:00
}
.menu-item {
display: block;
line-height: 2.5rem;
}
&.active {
display: block;
}
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background: $header-background-color-dark;
border-top-color: $global-border-color-dark;
}
}
}
&.open {
.header-wrapper {
margin-top: -$header-height;
}
.menu {
padding-top: 0;
border-top: none;
.menu-item {
display: none;
}
.search-cancel {
display: inline;
}
}
}
}
.search-dropdown {
position: fixed;
z-index: 200;
top: $header-height;
2021-02-18 22:21:36 +01:00
@include box-shadow(0 0.125rem 0.25rem rgba(0, 0, 0, 0.1));
2021-02-18 21:44:01 +01:00
&.desktop {
right: 2rem;
width: 30rem;
}
&.mobile {
right: 0;
width: 100%;
}
.dropdown-menu {
right: 0 !important;
background-color: $global-background-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background-color: $global-background-color-dark;
}
.suggestions {
overflow-y: auto;
max-height: calc(100vh - #{$header-height});
.suggestion {
2021-02-18 22:21:36 +01:00
padding: 0.75rem 1rem;
2021-02-18 21:44:01 +01:00
.suggestion-title {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 1rem;
font-weight: bold;
max-width: 75%;
}
.suggestion-date {
2021-02-18 22:21:36 +01:00
font-size: 0.875rem;
2021-02-18 21:44:01 +01:00
float: right;
text-align: right;
color: $global-font-secondary-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
color: $global-font-secondary-color-dark;
}
}
.suggestion-context {
line-height: 1.25rem;
@include box(vertical);
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
@include overflow-wrap(break-word);
color: $global-font-secondary-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
color: $global-font-secondary-color-dark;
}
}
em {
font-style: normal;
background-color: $selection-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background-color: $selection-color-dark;
}
}
&.cursor {
background: darken($code-background-color, 5%);
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
background: lighten($code-background-color-dark, 5%);
}
}
&:hover {
cursor: pointer;
}
}
}
.search-empty {
padding: 1rem;
text-align: center;
.search-query {
font-weight: bold;
2021-02-18 22:21:36 +01:00
[theme="dark"] & {
2021-02-18 21:44:01 +01:00
color: #ddd;
}
}
}
.search-footer {
2021-02-18 22:21:36 +01:00
padding: 0.5rem 1rem;
2021-02-18 21:44:01 +01:00
float: right;
2021-02-18 22:21:36 +01:00
font-size: 0.8rem;
2021-02-18 21:44:01 +01:00
color: $global-font-secondary-color;
2021-02-18 22:21:36 +01:00
[theme="dark"] {
2021-02-18 21:44:01 +01:00
color: $global-font-secondary-color-dark;
}
@include link(false, false);
a {
font-size: 1rem;
}
}
}
}