Skip to content

Instantly share code, notes, and snippets.

@artchen
Last active August 30, 2016 19:57
Show Gist options
  • Save artchen/876041cbd1201d6201f6b7b0daa4c4ed to your computer and use it in GitHub Desktop.
Save artchen/876041cbd1201d6201f6b7b0daa4c4ed to your computer and use it in GitHub Desktop.
Universal Search Style
@material-red: #f44336;
@material-pink: #E91E63;
@material-purple: #9c27b0;
@material-deep-purple: #673ab7;
@material-indigo: #3f51b5;
@material-blue: #2196f3;
@material-teal: #009688;
@material-green: #4caf50;
@material-light-green: #8bc34a;
@material-orange: #ff9800;
@material-deep-orange: #ff5722;
@material-brown: #795548;
@material-blue-grey: #607d8b;
@material-grey: #9e9e9e;
@material-yellow: #FFEB3B;
@tixora-color: #33475A;
@black: #414141;
@white: #ffffff;
@brand-color: @material-teal;
@accent-color: @material-orange;
@grey-color: #828282;
@modal-threshold: 680px;
#modal-search {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 60px 20px;
z-index: 999999;
@media (max-width: @modal-threshold) {
padding: 0px;
}
.modal {
position: fixed;
height: 80%;
width: 100%;
max-width: 640px;
left: 50%;
top: 0;
margin: 64px 0px 0px -320px;
background: #fff;
box-shadow: 0 7px 8px -4px rgba(0,0,0,.2),0 13px 19px 2px rgba(0,0,0,.14),0 5px 24px 4px rgba(0,0,0,.12);
z-index: 3;
@media (max-width: @modal-threshold) {
box-shadow: none;
max-width: none;
top: 0;
left: 0;
margin: 0;
height: 100%;
}
.ajax-content {
opacity: 0;
visibility: hidden;
transition: all 0.36s;
&.loaded {
opacity: 1;
visibility: visible;
}
}
.modal-header {
position: relative;
width: 100%;
height: 50px;
background-color: @tixora-color;
z-index: 3;
.close {
display: block;
position: absolute;
width: 50px;
height: 50px;
top: 0;
right: 0;
color: white;
cursor: pointer;
text-align: center;
line-height: 50px;
vertical-align: middle;
font-size: 18px;
transition: all 0.24s;
z-index: 2;
&:hover {
transform: rotate(90deg);
}
}
@keyframes loading {
from {
width: 0%;
}
to {
width: 100%;
}
}
.loading {
position: absolute;
bottom: -2px;
left: 0px;
width: 100%;
height: 2px;
background: transparent;
opacity: 1;
visibility: visible;
z-index: 1;
&.loaded {
opacity: 0;
visibility: hidden;
.bar {
width: 0%;
animation-name: none;
}
}
.bar {
display: block;
position: relative;
width: 0%;
height: 100%;
background: lighten(@accent-color,15%);
animation-duration: 1s;
animation-name: loading;
}
}
.modal-searchform {
position: relative;
width: 100%;
height: 100%;
z-index: 2;
.modal-input {
width: 100%;
padding: 0px 50px 0px 40px;
font-size: 15px;
line-height: 50px;
vertical-align: middle;
color: #fff;
border: none;
background: transparent;
transition: background-color 0.24s;
font-weight: thin;
appearance: none;
box-shadow: none;
&:focus {
background-color: lighten(@tixora-color,5%);
}
}
}
.search-bar-trigger {
position: absolute;
top: 0;
left: 0;
padding-left: 5px;
padding-top: 2px;
background: transparent;
border: none;
width: 40px;
height: 50px;
vertical-align: middle;
font-size: 20px;
color: white;
z-index: 2;
}
}
.modal-footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 50px;
padding: 0px 15px;
background: #fff;
border-top: 1px solid lighten(@black,60%);
.error {
float: left;
vertical-align: middle;
line-height: 50px;
font-size: 13px;
}
.meta {
float: left;
vertical-align: middle;
line-height: 50px;
font-size: 13px;
}
.nav {
display: block;
float: right;
vertical-align: middle;
font-size: 13px;
font-weight: 500;
line-height: 50px;
color: @grey-color;
cursor: pointer;
&:hover {
color: @black;
}
&.next {
margin-left: 10px;
}
.icon {
font-size: 12px;
}
}
}
.modal-body {
position: absolute;
padding: 64px 40px 80px 40px;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
@media (max-width: @modal-threshold) {
padding: 60px 20px 80px 20px;
}
.results {
list-style: none;
li {
border-bottom: 1px solid #e6e8ea;
&:last-child {
border-bottom: none;
}
}
.result {
position: relative;
display: block;
padding: 15px 30px 15px 0px;
&:hover {
.digest, .icon {
color: @black;
}
}
.title {
display: inline-block;
max-width: 100%;
color: @material-blue;
font-size: 15px;
font-weight: bold;
background: lighten(@material-blue,43%);
padding: 1px;
border-bottom: 1px solid #e6e8ea;
margin-bottom: 2px;
line-height: 110%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.digest {
display: block;
font-size: 13px;
line-height: 140%;
color: lighten(@black, 30%);
transition: color 0.24s;
}
.icon {
position: absolute;
top: 50%;
right: 0;
margin-top: -4px;
font-size: 11px;
color: @grey-color;
}
}
}
}
}
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.8);
z-index: 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment