hugo-theme-zzo/assets/sass/components/_search.scss

412 lines
8.6 KiB
SCSS
Raw Normal View History

2019-11-04 13:09:44 +00:00
.search {
position: relative;
border-radius: 0.25rem;
height: 35px;
2020-01-23 13:00:38 +00:00
max-width: 928px;
2019-11-04 13:09:44 +00:00
z-index: z('search');
2019-11-20 06:55:05 +00:00
margin-bottom: 0.5rem;
2019-11-04 13:09:44 +00:00
@include box-shadow(0, 0, 0, 3px, transparent);
@include transition(all, 0.15s, ease-in);
2019-11-04 13:09:44 +00:00
@include flexbox();
@include align-items(center);
@include themify($themes) {
2019-11-20 06:55:05 +00:00
border: 2px solid themed('search-border-color');
2019-11-04 13:09:44 +00:00
background-color: themed("search-background-color");
&:focus-within {
border: 2px solid themed('search-border-active-color');
@include box-shadow(0, 0, 0, 3px, themed('search-border-outline-color'));
}
2019-11-04 13:09:44 +00:00
}
.icon {
padding: 0.25rem;
@include flexbox();
@include themify($themes) {
color: themed("search-icon-color");
}
}
.input {
width: 100%;
font-size: 0.9rem;
border: none;
outline: none;
padding-right: 1rem;
@include truncate($grid_main_side_width + $grid_main_side_unit);
2019-11-04 13:09:44 +00:00
@include themify($themes) {
color: themed("search-color");
2020-01-24 19:36:42 +00:00
background-color: inherit;
2019-11-04 13:09:44 +00:00
@include input-placeholder {
font-family: $title-font;
2019-11-04 13:09:44 +00:00
color: themed("search-placeholder-color");
}
}
}
&-content {
margin-top: 0.25rem;
2019-11-25 13:53:34 +00:00
max-height: 350px;
overflow: auto;
2019-11-04 13:09:44 +00:00
a {
text-decoration: none !important;
&:not(:last-child) {
@include themify($themes) {
font-family: $title-font;
border-bottom: 2px dashed themed("search-placeholder-color");
}
}
2019-11-04 13:09:44 +00:00
}
}
&__highlight {
@include themify($themes) {
color: themed('search-highlight-color');
}
}
&-result {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
@include themify($themes) {
background-color: themed('body-background-color');
}
&[data-display="block"] {
display: block;
}
&[data-display="none"] {
display: none;
}
&__header {
}
&__body {
margin-top: 1rem;
padding: 0 1rem;
position: relative;
display: block;
overflow: auto;
height: 100%;
@include themify($themes) {
@include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
@include webkit-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
}
}
&__item {
&:not(first-child) {
padding-bottom: 2.25rem;
}
&--title {
font-family: $title-font;
font-size: 1.5rem;
margin: 0.25rem 0;
&::before {
content: "📋 ";
}
}
&--desc {
font-size: 1rem;
margin: 0.25rem 0;
}
}
&__close {
position: absolute;
cursor: pointer;
&[data-dir="ltr"] {
right: 0.5rem;
top: -1.5rem;
}
&[data-dir="rtl"] {
left: 0.5rem;
top: -1.5rem;
}
@include themify($themes) {
color: themed('social-icon-color');
@include on-event {
color: themed('social-icon-hover-color');
}
}
}
}
2019-11-04 13:09:44 +00:00
}
.menu-item {
padding: 0.25rem;
&__title {
font-size: 1rem;
2019-11-04 13:09:44 +00:00
@include themify($themes) {
2019-11-20 06:55:05 +00:00
color: themed('body-color');
2019-11-04 13:09:44 +00:00
}
&::before {
content: '📄 ';
}
2019-11-04 13:09:44 +00:00
}
&__desc {
font-size: 0.8rem;
padding: 0.25rem 0.5rem;
@include truncate($grid_main_side_width + $grid_main_side_unit);
2019-11-04 13:09:44 +00:00
@include themify($themes) {
color: themed('meta-color');
2019-11-04 13:09:44 +00:00
}
}
}
#search-results {
&.dropdown {
display: none;
&.is-active {
display: inline-block;
margin-top: 0.25rem;
position: absolute;
2020-01-24 12:24:17 +00:00
left: 0;
top: 35px;
2019-11-04 13:09:44 +00:00
width: 100%;
border-radius: 0.1rem;
@include box-shadow(0, 1px, 3px, 0, rgba(0, 0, 0, 0.4));
@include themify($themes) {
color: themed('search-content-color');
background-color: themed('search-content-background-color');
}
}
}
2019-11-04 13:09:44 +00:00
.dropdown {
&-content {
@include themify($themes) {
@include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
@include webkit-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
}
2019-11-04 13:09:44 +00:00
@include flexbox();
@include flex-direction(column);
}
&-item {
font-size: 1rem;
padding: 0.125rem 0.25rem;
2019-11-04 13:09:44 +00:00
@include on-event {
@include themify($themes) {
background-color: themed('search-hover-background-color');
}
border-bottom-left-radius: 0.1rem;
border-bottom-right-radius: 0.1rem;
}
&.is-active {
@include themify($themes) {
background-color: themed('search-hover-background-color');
}
}
}
}
}
.mobile-search {
position: absolute;
2020-01-23 13:00:38 +00:00
top: 0;
left: 0;
2019-11-20 06:55:05 +00:00
z-index: z('modal');
2020-01-23 13:00:38 +00:00
width: 100%;
overflow: hidden;
@include themify($themes) {
@include webkit-scrollbars2(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
}
2019-11-20 06:55:05 +00:00
&__top {
width: 100%;
height: $grid_navbar_height;
text-align: right;
position: relative;
direction: rtl;
2019-11-20 06:55:05 +00:00
@include flexbox();
@include align-items(center);
@include themify($themes) {
border-bottom: 1px solid themed('navbar-border-bottom-color');
background-color: themed('navbar-background-color');
}
&--icon {
width: 50px;
height: $grid_navbar_height;
cursor: pointer;
position: absolute;
2020-01-23 13:00:38 +00:00
top: 0;
2019-11-20 06:55:05 +00:00
@include flexbox();
@include align-items(center);
@include justify-content(center);
@include themify($themes) {
color: themed('burger-menu-color');
@include on-event {
color: themed('link-hover');
}
}
}
&--input {
position: absolute;
width: calc(100% - 50px);
2019-11-20 06:55:05 +00:00
height: 70%;
outline: none;
border: none;
border-radius: 0.25rem;
padding: 0 1rem;
font-size: 1.1rem;
2019-11-20 06:55:05 +00:00
@include themify($themes) {
color: themed('body-color');
background-color: themed('navbar-background-color');
@include input-placeholder {
font-family: $title-font;
2019-11-20 06:55:05 +00:00
color: themed("search-placeholder-color");
}
}
}
}
&__body {
2020-01-23 13:00:38 +00:00
width: 100vw;
height: 100vh;
overflow-y: auto;
2019-11-20 06:55:05 +00:00
@include themify($themes) {
color: themed('body-color');
background-color: themed('body-background-color');
@include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
2019-11-20 06:55:05 +00:00
}
}
&[data-dir="ltr"] {
.mobile-search__top--icon {
right: 0;
}
.mobile-search__body {
direction: ltr;
}
.mobile-search__top--input {
direction: ltr;
left: 0;
}
}
&[data-dir="rtl"] {
.mobile-search__top--icon {
left: 0;
}
.mobile-search__body {
direction: rtl;
}
.mobile-search__top--input {
direction: rtl;
right: 0;
}
2019-11-20 06:55:05 +00:00
}
&__btn {
position: absolute;
top: 0;
right: 35px;
width: 35px;
height: $grid_navbar_height;
padding: 0.25rem;
2019-11-20 06:55:05 +00:00
cursor: pointer;
display: none;
z-index: z('search-btn');
2019-11-20 06:55:05 +00:00
&[data-ani="true"] {
@include animation('slide-in-down .5s .25s 1 ease both');
}
2019-11-20 06:55:05 +00:00
@include themify($themes) {
color: themed('burger-menu-color');
background-color: themed('navbar-background-color');
2020-02-16 18:55:32 +00:00
border-bottom: 1px solid themed('navbar-border-bottom-color');
2019-11-20 06:55:05 +00:00
@include on-event {
color: themed('link-hover');
}
}
2019-12-08 14:29:02 +00:00
@media only screen and (max-width: 769px) {
@include flexbox();
@include align-items(center);
@include justify-content(center);
}
2019-11-20 06:55:05 +00:00
}
&__content {
a {
text-decoration: none !important;
}
}
2019-11-20 06:55:05 +00:00
&__item {
padding: 0.5rem;
list-style-type: none;
&:not(first-child) {
padding-bottom: 0.75rem;
}
2019-11-20 06:55:05 +00:00
&--title {
font-family: $title-font;
2019-11-20 06:55:05 +00:00
font-size: 1.2rem;
margin: 0.25rem 0;
2019-11-20 06:55:05 +00:00
@include themify($themes) {
color: themed('body-color');
}
&::before {
content: "📋 ";
}
2019-11-20 06:55:05 +00:00
}
&--desc {
font-size: 0.9rem;
padding: 0.25rem 0.5rem;
@include truncate(960px);
2019-11-20 06:55:05 +00:00
@include themify($themes) {
color: themed('search-color');
}
}
@include on-event {
@include themify($themes) {
background-color: themed('search-hover-background-color');
}
}
}
}