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-09-23 11:56:25 +02:00
|
|
|
padding: 0.4rem;
|
|
|
|
padding-right: 3.2rem;
|
|
|
|
}
|
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;
|
|
|
|
background: $md-color-white;
|
|
|
|
opacity: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
// Expanded overlay
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
|
|
|
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-10-23 10:21:37 +02:00
|
|
|
.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
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
|
|
|
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
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
|
|
|
|
|
|
|
// [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-09-13 20:58:28 +02:00
|
|
|
background: $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-09-13 20:58:28 +02:00
|
|
|
background: $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
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
2016-10-23 10:21:37 +02:00
|
|
|
border-radius: 0.2rem 0.2rem 0 0;
|
2016-09-02 00:33:45 +02:00
|
|
|
background: $md-color-white;
|
|
|
|
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
|
|
|
|
|
|
|
// Icon
|
|
|
|
&__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
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
|
|
|
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;
|
|
|
|
|
|
|
|
// [tablet landscape +]: Limit height to viewport
|
|
|
|
@include break-from-device(tablet landscape) {
|
|
|
|
max-height: 0;
|
|
|
|
|
|
|
|
// Expand in active state
|
|
|
|
.md-toggle--search:checked ~ .md-header & {
|
|
|
|
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
|
|
|
}
|