Skip to content

Commit

Permalink
Add animation and persist search bar in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
rukmini-bose authored and ozyx committed Feb 15, 2024
1 parent f4d55e1 commit 7ffd4e7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
10 changes: 10 additions & 0 deletions src/ui/components/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
&:before {
// Mag glass icon
content: $glyph-icon-magnify;
body.mobile & { // Make search icon stand out in mobile
opacity: 1;
}
}

&__use-regex {
Expand Down Expand Up @@ -54,12 +57,19 @@
}

&.is-active {
body.mobile & { // In mobile, persist the expanded search bar instead of collapsing upon clicking away
background-color: rgba($colorHeadFg, 0.2) !important;
width: 50vw !important;
}
.c-search__use-regex {
margin-left: 0;
}

&:before {
width: 0;
body.mobile & {
width: auto;
}
}

input[type='text'],
Expand Down
34 changes: 19 additions & 15 deletions src/ui/layout/search/search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@
background: rgba($colorHeadFg, 0.2);
box-shadow: none;
flex: 1 1 auto;
// body.mobile & {
// @include phonePortrait() { // This logic of expanding the search input upon click only happens in mobile portrait mode
// background: $colorHeadBg;
// width: 15%;
// &:hover {
// background-color: rgba($colorHeadFg, 0.2);
// width: 100%;
// }
// }
// }
body.mobile & {
@include phonePortrait() {
// This logic of expanding the search input upon click only happens in mobile portrait mode
background: $colorHeadBg;
width: 15%;
&:hover {
// When clicked, expand the search bar
background-color: rgba($colorHeadFg, 0.2);
width: 50vw;
transition: width 120ms;
}
}
}
}
}

Expand All @@ -50,7 +53,8 @@
max-height: 500px;
top: $formInputH;
z-index: 60;
body.mobile & { // Makes search in mobile look less like an overlay, and more fullscreen.
body.mobile & {
// Makes search in mobile look less like an overlay, and more fullscreen.
position: absolute;
top: 25px;
left: -12px;
Expand Down Expand Up @@ -107,7 +111,7 @@
}

body.mobile & {
width: 50%;
width: 50vw;
@include phonePortrait() {
// This logic only appears for a mobile portrait mode
width: 100%;
Expand Down Expand Up @@ -154,9 +158,9 @@
}

.c-location {
//color: $colorBodyFg;
//font-size: 0.9em;
//opacity: 0.8;
color: $colorBodyFg;
font-size: 0.9em;
opacity: 0.8;
}
}

Expand Down

0 comments on commit 7ffd4e7

Please sign in to comment.