2016-09-04 17:11:58 +02:00
|
|
|
////
|
|
|
|
/// Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
|
|
|
|
///
|
|
|
|
/// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
/// copy of this software and associated documentation files (the "Software"),
|
|
|
|
/// to deal in the Software without restriction, including without limitation
|
|
|
|
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
/// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
/// Software is furnished to do so, subject to the following conditions:
|
|
|
|
///
|
|
|
|
/// The above copyright notice and this permission notice shall be included in
|
|
|
|
/// all copies or substantial portions of the Software.
|
|
|
|
///
|
|
|
|
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
/// DEALINGS
|
|
|
|
////
|
|
|
|
|
2016-09-04 17:32:12 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
2016-10-06 12:14:33 +02:00
|
|
|
// Rules
|
2016-09-04 17:32:12 +02:00
|
|
|
// ----------------------------------------------------------------------------
|
2016-09-04 17:11:58 +02:00
|
|
|
|
2016-10-06 12:14:33 +02:00
|
|
|
// Search container
|
2016-09-02 00:33:45 +02:00
|
|
|
.md-search {
|
2016-09-23 11:56:25 +02:00
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// Hide search, if JavaScript is not available.
|
2016-09-30 13:29:45 +02:00
|
|
|
.no-js & {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// [tablet landscape +]: Header-embedded search
|
|
|
|
@include break-from-device(tablet landscape) {
|
2016-12-15 20:04:30 +01:00
|
|
|
margin-right: 2.8rem;
|
2016-09-23 11:56:25 +02:00
|
|
|
padding: 0.4rem;
|
|
|
|
}
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// Search modal overlay
|
|
|
|
&__overlay {
|
|
|
|
display: none;
|
|
|
|
pointer-events: none;
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// [tablet portrait -]: Full-screen search bar
|
2016-10-23 10:21:37 +02:00
|
|
|
@include break-to-device(tablet portrait) {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
top: 0.4rem;
|
|
|
|
left: 0.4rem;
|
|
|
|
width: 4.0rem;
|
|
|
|
height: 4.0rem;
|
|
|
|
transform-origin: center;
|
|
|
|
transition:
|
|
|
|
transform 0.3s 0.1s,
|
|
|
|
opacity 0.2s 0.2s;
|
|
|
|
border-radius: 2.0rem;
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: $md-color-white;
|
2016-10-23 10:21:37 +02:00
|
|
|
opacity: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
// Expanded overlay
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-23 10:21:37 +02:00
|
|
|
transition:
|
|
|
|
transform 0.4s,
|
|
|
|
opacity 0.1s;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// Set scale factors
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// [mobile portrait -]: Scale up 45 times
|
|
|
|
@include break-to-device(mobile portrait) {
|
|
|
|
transform: scale(45);
|
|
|
|
}
|
|
|
|
|
|
|
|
// [mobile landscape]: Scale up 60 times
|
|
|
|
@include break-at-device(mobile landscape) {
|
|
|
|
transform: scale(60);
|
|
|
|
}
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// [tablet portrait]: Scale up 75 times
|
2016-10-23 10:21:37 +02:00
|
|
|
@include break-at-device(tablet portrait) {
|
|
|
|
transform: scale(75);
|
|
|
|
}
|
2016-09-02 00:33:45 +02:00
|
|
|
}
|
2016-10-23 10:21:37 +02:00
|
|
|
}
|
2016-09-30 13:29:45 +02:00
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// Search modal wrapper
|
|
|
|
&__inner {
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
// [tablet portrait -]: Put search modal off-canvas by default
|
|
|
|
@include break-to-device(tablet portrait) {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 100%;
|
|
|
|
height: 100%;
|
|
|
|
transform: translateX(5%);
|
|
|
|
transition:
|
|
|
|
left 0s 0.3s,
|
|
|
|
transform 0.15s 0.15s cubic-bezier(0.4, 0.0, 0.2, 1.0),
|
|
|
|
opacity 0.15s 0.15s;
|
|
|
|
opacity: 0;
|
|
|
|
z-index: 2;
|
|
|
|
|
|
|
|
// Active search modal
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-23 10:21:37 +02:00
|
|
|
left: 0;
|
|
|
|
transform: translateX(0);
|
|
|
|
transition:
|
|
|
|
left 0s 0s,
|
|
|
|
transform 0.15s 0.15s cubic-bezier(0.1, 0.7, 0.1, 1.0),
|
|
|
|
opacity 0.15s 0.15s;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// [tablet landscape +]: Make relative for inner layout
|
2016-10-23 10:21:37 +02:00
|
|
|
@include break-from-device(tablet landscape) {
|
2016-10-30 10:36:18 +01:00
|
|
|
display: table;
|
2016-10-23 10:21:37 +02:00
|
|
|
position: relative;
|
2016-10-30 10:36:18 +01:00
|
|
|
clear: both;
|
2016-10-23 10:21:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Search form
|
|
|
|
&__form {
|
2016-10-30 10:36:18 +01:00
|
|
|
position: relative;
|
2016-10-23 10:21:37 +02:00
|
|
|
|
|
|
|
// [tablet landscape +]: Header-embedded search
|
|
|
|
@include break-from-device(tablet landscape) {
|
2016-09-30 13:29:45 +02:00
|
|
|
width: 23.0rem;
|
2016-10-23 19:31:54 +02:00
|
|
|
|
|
|
|
// Hack: omit jitter when form is resized
|
|
|
|
float: right;
|
|
|
|
|
2016-09-30 13:29:45 +02:00
|
|
|
transition: width 0.25s cubic-bezier(0.1, 0.7, 0.1, 1.0);
|
2016-10-23 10:21:37 +02:00
|
|
|
border-radius: 0.2rem;
|
2016-10-30 10:36:18 +01:00
|
|
|
}
|
2016-09-30 13:29:45 +02:00
|
|
|
|
2016-10-30 10:36:18 +01:00
|
|
|
// Set maximum width
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-30 10:36:18 +01:00
|
|
|
|
|
|
|
// [tablet landscape]: Do not overlay title
|
|
|
|
@include break-at-device(tablet landscape) {
|
|
|
|
width: 46.8rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [screen +]: Match content width
|
|
|
|
@include break-from-device(screen) {
|
2016-09-30 13:29:45 +02:00
|
|
|
width: 66.8rem;
|
|
|
|
}
|
|
|
|
}
|
2016-09-02 00:33:45 +02:00
|
|
|
}
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// Search input
|
2016-09-02 00:33:45 +02:00
|
|
|
&__input {
|
2016-10-23 19:31:54 +02:00
|
|
|
position: relative;
|
2016-10-23 10:21:37 +02:00
|
|
|
padding: 0 1.6rem 0 7.2rem;
|
2016-09-13 20:58:28 +02:00
|
|
|
text-overflow: ellipsis;
|
2016-10-23 19:31:54 +02:00
|
|
|
z-index: 1;
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-09-04 17:32:12 +02:00
|
|
|
// Placeholder and icon color in active state
|
2016-09-02 00:33:45 +02:00
|
|
|
+ .md-search__icon,
|
|
|
|
&::placeholder {
|
|
|
|
color: $md-color-black--light;
|
|
|
|
}
|
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// [tablet portrait -]: Full-screen search bar
|
|
|
|
@include break-to-device(tablet portrait) {
|
2016-09-02 00:33:45 +02:00
|
|
|
width: 100%;
|
2016-10-23 10:21:37 +02:00
|
|
|
height: 5.6rem;
|
2016-09-02 00:33:45 +02:00
|
|
|
font-size: 1.8rem;
|
|
|
|
}
|
|
|
|
|
2016-10-23 10:21:37 +02:00
|
|
|
// [tablet landscape +]: Header-embedded search
|
|
|
|
@include break-from-device(tablet landscape) {
|
2016-09-30 13:29:45 +02:00
|
|
|
width: 100%;
|
2016-09-02 00:33:45 +02:00
|
|
|
height: 4.0rem;
|
|
|
|
padding-left: 4.8rem;
|
2016-10-23 10:21:37 +02:00
|
|
|
transition:
|
|
|
|
background-color 0.25s,
|
|
|
|
color 0.25s;
|
|
|
|
border-radius: 0.2rem;
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: $md-color-black--lighter;
|
2016-09-02 00:33:45 +02:00
|
|
|
color: $md-color-white;
|
2016-09-04 17:11:58 +02:00
|
|
|
font-size: ms(0);
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-09-04 17:32:12 +02:00
|
|
|
// Placeholder color
|
2016-09-02 00:33:45 +02:00
|
|
|
+ .md-search__icon,
|
|
|
|
&::placeholder {
|
2016-09-04 17:11:58 +02:00
|
|
|
transition: color 0.25s;
|
2016-09-02 00:33:45 +02:00
|
|
|
color: $md-color-white;
|
|
|
|
}
|
|
|
|
|
2016-09-08 19:43:23 +02:00
|
|
|
// Hovered search field
|
|
|
|
&:hover {
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: $md-color-white--lightest;
|
2016-09-08 19:43:23 +02:00
|
|
|
}
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// Set light background on active search field
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-23 10:21:37 +02:00
|
|
|
border-radius: 0.2rem 0.2rem 0 0;
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: $md-color-white;
|
2016-09-02 00:33:45 +02:00
|
|
|
color: $md-color-black;
|
2016-09-13 20:58:28 +02:00
|
|
|
text-overflow: none;
|
2016-09-02 00:33:45 +02:00
|
|
|
|
2016-09-04 17:32:12 +02:00
|
|
|
// Placeholder and icon color in active state
|
2016-09-02 00:33:45 +02:00
|
|
|
+ .md-search__icon,
|
|
|
|
&::placeholder {
|
|
|
|
color: $md-color-black--light;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-23 19:31:54 +02:00
|
|
|
|
2016-12-16 09:21:31 +01:00
|
|
|
// Icons
|
2016-10-23 19:31:54 +02:00
|
|
|
&__icon {
|
|
|
|
position: absolute;
|
|
|
|
top: $md-icon-padding;
|
|
|
|
left: $md-icon-padding + $md-icon-margin;
|
|
|
|
transition: color 0.25s;
|
|
|
|
font-size: $md-icon-size;
|
|
|
|
cursor: pointer;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
// Set search icon on pseudo class, so it can be overridden for mobile
|
|
|
|
// and tablet when the search is rendered in an overlay
|
|
|
|
&::before {
|
|
|
|
content: "search";
|
|
|
|
}
|
|
|
|
|
|
|
|
// [tablet portrait -]: Full-screen search bar
|
|
|
|
@include break-to-device(tablet portrait) {
|
|
|
|
top: 1.6rem;
|
|
|
|
left: 1.6rem;
|
|
|
|
|
|
|
|
// Show back arrow instead of search icon
|
|
|
|
&::before {
|
|
|
|
content: "arrow_back";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Search output container
|
|
|
|
&__output {
|
2016-10-30 10:36:18 +01:00
|
|
|
position: absolute;
|
2016-10-23 19:31:54 +02:00
|
|
|
width: 100%;
|
|
|
|
border-radius: 0 0 0.2rem 0.2rem;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
// [tablet portrait -]: Full-screen search bar
|
|
|
|
@include break-to-device(tablet portrait) {
|
|
|
|
top: 5.6rem;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [tablet landscape +]: Header-embedded search
|
|
|
|
@include break-from-device(tablet landscape) {
|
|
|
|
@include z-depth(6);
|
|
|
|
|
2016-10-30 10:36:18 +01:00
|
|
|
top: 4.0rem;
|
2016-10-23 19:31:54 +02:00
|
|
|
transition: opacity 0.4s;
|
|
|
|
opacity: 0;
|
|
|
|
|
|
|
|
// Show search output in active state
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-23 19:31:54 +02:00
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wrapper for scrolling on overflow
|
|
|
|
&__scrollwrap {
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
// Pure CSS scrolling shadows, taken from
|
|
|
|
// http://lea.verou.me/2012/04/background-attachment-local/
|
|
|
|
background:
|
|
|
|
linear-gradient(
|
|
|
|
to bottom,
|
|
|
|
$md-color-white 10%,
|
|
|
|
$md-color-white--transparent),
|
|
|
|
linear-gradient(
|
|
|
|
to bottom,
|
|
|
|
$md-color-black--lighter,
|
|
|
|
$md-color-black--lightest 35%,
|
|
|
|
$md-color-black--transparent 60%);
|
|
|
|
background-attachment: local, scroll;
|
|
|
|
background-color: $md-color-white;
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
background-size: 100% 2.0rem, 100% 1.0rem;
|
|
|
|
|
|
|
|
box-shadow: 0 0.1rem 0 $md-color-black--lightest inset;
|
|
|
|
overflow-y: auto;
|
|
|
|
|
2016-12-15 15:55:40 +01:00
|
|
|
// [tablet landscape]: Set absolute width to omit unnecessary reflow
|
|
|
|
@include break-at-device(tablet landscape) {
|
|
|
|
width: 46.8rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
// [screen +]: Set absolute width to omit unnecessary reflow
|
|
|
|
@include break-from-device(screen) {
|
|
|
|
width: 66.8rem;
|
|
|
|
}
|
|
|
|
|
2016-10-23 19:31:54 +02:00
|
|
|
// [tablet landscape +]: Limit height to viewport
|
|
|
|
@include break-from-device(tablet landscape) {
|
|
|
|
max-height: 0;
|
|
|
|
|
|
|
|
// Expand in active state
|
2016-12-15 15:55:40 +01:00
|
|
|
[data-md-toggle="search"]:checked ~ .md-header & {
|
2016-10-23 19:31:54 +02:00
|
|
|
max-height: 75vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Override native scrollbar styles
|
|
|
|
&::-webkit-scrollbar {
|
|
|
|
width: 0.4rem;
|
|
|
|
height: 0.4rem;
|
2016-11-05 23:26:07 +01:00
|
|
|
}
|
2016-10-23 19:31:54 +02:00
|
|
|
|
2016-11-05 23:26:07 +01:00
|
|
|
// Style scrollbar thumb
|
|
|
|
&::-webkit-scrollbar-thumb {
|
|
|
|
background-color: $md-color-black--lighter;
|
2016-10-23 19:31:54 +02:00
|
|
|
|
2016-11-05 23:26:07 +01:00
|
|
|
// Hovered scrollbar thumb
|
|
|
|
&:hover {
|
|
|
|
background-color: $md-color-accent;
|
2016-10-23 19:31:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-09-04 17:11:58 +02:00
|
|
|
}
|
2016-12-16 09:21:31 +01:00
|
|
|
|
|
|
|
// Search result
|
|
|
|
.md-search-result {
|
|
|
|
|
|
|
|
// Search metadata
|
|
|
|
&__meta {
|
|
|
|
padding: 0 1.6rem;
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: $md-color-black--lightest;
|
2016-12-16 09:21:31 +01:00
|
|
|
color: $md-color-black--light;
|
|
|
|
font-size: ms(-1);
|
|
|
|
line-height: 4.0rem;
|
|
|
|
|
|
|
|
// [tablet landscape +]: Increase left indent
|
|
|
|
@include break-from-device(tablet landscape) {
|
|
|
|
padding-left: 4.8rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// List of items
|
|
|
|
&__list {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
border-top: 0.1rem solid $md-color-black--lightest;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
// List item
|
|
|
|
&__item {
|
|
|
|
box-shadow: 0 -0.1rem 0 $md-color-black--lightest;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Link inside item
|
|
|
|
&__link {
|
|
|
|
display: block;
|
|
|
|
padding: 0 1.6rem;
|
|
|
|
transition: background 0.25s;
|
|
|
|
overflow: auto;
|
|
|
|
|
|
|
|
// Hovered link
|
|
|
|
&:hover {
|
2016-12-17 12:53:24 +01:00
|
|
|
background-color: transparentize($md-color-accent, 0.9);
|
2016-12-16 09:21:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// [tablet landscape +]: Increase left indent
|
|
|
|
@include break-from-device(tablet landscape) {
|
|
|
|
padding-left: 4.8rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Search result content
|
|
|
|
&__article {
|
|
|
|
margin: 1.0em 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Search result title
|
|
|
|
&__title {
|
|
|
|
margin-top: 0.5em;
|
|
|
|
margin-bottom: 0;
|
|
|
|
color: $md-color-black;
|
|
|
|
font-size: ms(0);
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1.4;
|
|
|
|
}
|
|
|
|
|
2016-12-17 12:53:24 +01:00
|
|
|
// Search result teaser
|
2016-12-16 09:21:31 +01:00
|
|
|
&__teaser {
|
|
|
|
margin: 0.5em 0;;
|
|
|
|
color: $md-color-black--light;
|
|
|
|
font-size: ms(-1);
|
|
|
|
line-height: 1.4;
|
|
|
|
word-break: break-word;
|
|
|
|
}
|
|
|
|
}
|