add search support

This commit is contained in:
jackyzha0 2021-08-27 14:08:11 -04:00
parent a0ff5ec48c
commit 1c851271ea
10 changed files with 367 additions and 60 deletions

View file

@ -235,4 +235,120 @@ a[href^="/"] {
.centered {
margin-top: 30vh;
}
header {
display: flex;
flex-direction: row;
align-items: center;
& > nav {
@media all and (max-width: 600px) {
display: none;
}
& > a {
margin-left: 2em;
}
}
& > .spacer {
flex: 1 1 auto;
}
& > svg {
cursor: pointer;
width: 18px;
min-width: 18px;
margin: 0 1em;
&:hover .search-path {
stroke: var(--tertiary);
}
.search-path {
stroke: var(--gray);
stroke-width: 2px;
transition: stroke 0.5s ease;
}
}
}
#search-container {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
display: none;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
& > div {
width: 50%;
margin-top: 15vh;
margin-left: auto;
margin-right: auto;
@media all and (max-width: 1200px) {
width: 90%;
}
& > * {
width: 100%;
border-radius: 4px;
background: var(--light);
box-shadow: 0 14px 50px rgba(27, 33, 48, 0.12), 0 10px 30px rgba(27, 33, 48, 0.16);
margin-bottom: 2em;
}
& > input {
box-sizing: border-box;
padding: 0.5em 1em;
font-family: Inter, sans-serif;
color: var(--dark);
font-size: 1.1em;
border: 1px solid var(--outlinegray);
&:focus {
outline: none;
}
}
& > #results-container {
& > .result-card {
padding: 1em;
cursor: pointer;
transition: background 0.2s ease;
border: 1px solid var(--outlinegray);
border-bottom: none;
&:hover {
background: rgba(180, 180, 180, 0.15);
}
&:first-of-type {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
&:last-of-type {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom: 1px solid var(--outlinegray);
}
& > h3, & > p {
margin: 0;
}
& .search-highlight {
background-color: #afbfc966;
padding: 0.05em 0.2em;
border-radius: 3px;
}
}
}
}
}

View file

@ -1,67 +1,44 @@
.darkmode {
text-align: right;
float: right;
padding: 1em;
min-width: 30px;
position: relative;
@media all and (max-width: 450px) {
padding: 1em;
}
& > .toggle {
display: none;
box-sizing: border-box;
&:checked + .toggle-button:after {
left: 50%;
}
& + .toggle-button {
box-sizing: border-box;
outline: 0;
display: inline-block;
width: 3em;
height: 1.5em;
position: relative;
cursor: pointer;
border: 2px solid var(--gray);
user-select: none;
padding: 2px;
transition: all 0.2s ease;
border-radius: 2em;
&:after, &:before {
position: relative;
display: block;
box-sizing: border-box;
content: "";
width: 50%;
height: 100%;
}
&:before {
display: none;
}
&:after {
left: 0;
transition: all 0.2s ease;
background: var(--gray);
content: "";
border-radius: 1em;
}
}
}
& #dayIcon {
position: relative;
& svg {
opacity: 0;
position: absolute;
width: 20px;
height: 20px;
top: -1.5px;
top: calc(50% - 10px);
margin: 0 7px;
fill: var(--gray);
transition: opacity 0.1s ease;
}
}
& #nightIcon {
position: relative;
width: 18px;
height: 18px;
top: -2px;
margin: 0 7px;
fill: var(--gray);
.toggle:checked ~ label {
& > #dayIcon {
opacity: 0;
}
& > #nightIcon {
opacity: 1;
}
}
.toggle:not(:checked) ~ label {
& > #dayIcon {
opacity: 1;
}
& > #nightIcon {
opacity: 0;
}
}