Skip to content

Commit

Permalink
Add full screen search form and improve theme styling
Browse files Browse the repository at this point in the history
Added functionality for a full screen search form, updated styling for header and navigation, and reorganised SASS assets. The search form function was added in `elementor-functions.php` and can be toggled in the header. Numerous styling changes for better user interface and user experience were made to `theme.scss` and new colors were added to `_variables.scss`. The SASS files were also reorganised: `navigation-toggle.scss` was moved under "Elements" in `theme.scss`, and `_search-form.scss`, a new file, was created.
  • Loading branch information
garikhg committed Apr 7, 2024
1 parent d200688 commit c87ece1
Show file tree
Hide file tree
Showing 14 changed files with 822 additions and 135 deletions.
11 changes: 11 additions & 0 deletions assets/sass/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@mixin font-icon {
font-family: "Font Awesome 6 Free";
font-weight: 900;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
display: var(--fa-display, inline-block);
font-style: normal;
font-variant: normal;
line-height: 1;
text-rendering: auto;
}
2 changes: 2 additions & 0 deletions assets/sass/abstracts/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ $gray-base: #212529 !default;
$blue: #605be5 !default;
$dark-blue: #333366 !default;
$light-gray: #e8e8e8 !default;
$black: #000 !default;
$white: #fff !default;


// Text and Paragraph
Expand Down
6 changes: 5 additions & 1 deletion assets/sass/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
@import "theme/general";
@import "theme/header-and-footer";
@import "theme/navigation";
@import "theme/navigation-toggle";
@import "theme/posts-and-pages";
@import "theme/comments";
@import "theme/layouts";

// Elements

@import "theme/navigation-toggle";
@import "theme/search-form";
12 changes: 11 additions & 1 deletion assets/sass/theme/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
}

.site-branding {
&.show-logo {
display: flex;
align-items: center;

&.show-logo {
.site-title {
display: none !important;
}
Expand All @@ -50,5 +52,13 @@
text-decoration: none;
}
}

// Header Section
.header-section {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
}

5 changes: 0 additions & 5 deletions assets/sass/theme/_navigation-toggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
@use "sass:math";

// Settings
// ==================================================
$hamburger-padding-x: 15px !default;
$hamburger-padding-y: 15px !default;
$hamburger-layer-width: 40px !default;
Expand All @@ -16,9 +14,6 @@ $hamburger-hover-opacity: 0.7 !default;
$hamburger-active-layer-color: $hamburger-layer-color !default;
$hamburger-active-hover-opacity: $hamburger-hover-opacity !default;

// To use CSS filters as the hover effect instead of opacity,
// set $hamburger-hover-use-filter as true and
// change the value of $hamburger-hover-filter accordingly.
$hamburger-hover-use-filter: false !default;
$hamburger-hover-filter: opacity(50%) !default;
$hamburger-active-hover-filter: $hamburger-hover-filter !default;
Expand Down
96 changes: 94 additions & 2 deletions assets/sass/theme/_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,104 @@

.site-navigation {

ul {
display: flex;
ul.menu, ul.menu ul {
margin: 0;
padding: 0;
list-style: none;
}

ul.menu {
display: flex;
flex-wrap: wrap;

li {
position: relative;
display: flex;

a {
display: block;
padding: 10px 16px;

&:hover {
text-decoration: none;
}
}

&.menu-item-has-children {
padding-inline-end: 13px;

> a {
padding: 10px 7px 10px 16px;
}

&:after {
content: '\f107';
width: 13px;
height: 14px;
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
@include font-icon;
}

&:focus-within {
& > ul {
display: block;
}
}
}

ul {
background: $white;
min-width: 210px;
padding: 10px 0;
position: absolute;
z-index: 10;
left: 0;
top: 100%;
max-height: 0;
border-radius: 8px;
transform: scaleY(0);
transform-origin: top;
box-shadow: 0 12px 12px #0000001a;
transition: max-height 200ms, transform 200ms;

li {
display: block;
border-block-end: solid 1px $light-gray;

a {
text-align: left;
opacity: .78;
transition: opacity 200ms ease-in-out 0ms;

&:hover {
opacity: 1;
}
}
}

li:last-child {
border-block-end: none;
}
}


&:hover {

& > ul {
transform: scaleY(1);
max-height: 100vh;
}

&.menu-item-has-children:after {
transform: translateY(-50%) rotate(180deg);
}

}
}
}
}

.site-navigation-dropdown {
Expand Down
159 changes: 159 additions & 0 deletions assets/sass/theme/_search-form.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
.search-form {

//&:not(.show) {
// display: none;
//}

.font-icon-svg-container {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}

&__toggle {
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
width: var(--e-wpkit-header-search--toggle-size, 2.5rem); /* 40/16 */
height: var(--e-wpkit-header-search--toggle-size, 2.5rem); /* 40/16 */
min-width: 2.5rem; /* 40/16 */
min-height: 2.5rem; /* 40/16 */

.font-icon-svg-container {
font-size: var(--e-wpkit-header-search--toggle-size, 1.5rem); /* 24/16 */
}

> * {
pointer-events: none;
}
}

&--skin-classic {
}

&--skin-minimal {
}

&--skin-full_screen {
}
}

.search-overlay {
padding-top: 5.625rem; /* 90/16 */
position: fixed;
width: 100%;
top: 0;
left: 0;
bottom: 0;
z-index: 9999;
visibility: hidden;
opacity: 0;
transition: all 200ms ease-in-out 0ms;
background: var(--e-wpkit-search-full-screen--overlay-background, #fff);

&.is-visible {
opacity: 1;
visibility: visible;
}

.search-top {

position: relative;
margin-block-end: 2.625rem; /* 42/16 */

}

.container {
width: 100%;
max-width: 100%;
display: block;
margin-right: auto;
margin-left: auto;
padding-left: 0;
padding-right: 0;

}

.close-search {

font-size: 1.625rem; /* 26/16 */
line-height: 1;
user-select: none;
cursor: pointer;
width: 2.625rem; /* 42/16 */
height: 2.625rem; /* 42/16 */
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
right: 0;

&:after {
content: '\f00d';
font-family: var(--fa-style-family, "Font Awesome 6 Free");
font-weight: var(--fa-style, 900);
transform-origin: center;
transition: all 300ms ease-in-out 0ms;
}

&:hover:after {
transform: rotate(180deg);
}

}

.search-form {

&__container {

display: flex;
position: relative;

}

.search-field {
--e-wpkit-search-field-gutter-y: 1rem; /* 16/16 */
--e-wpkit-search-full-screen--field-height: 2.25rem; /* 36/16 */
--e-wpkit-search-full-screen--field-pe: 2.25rem; /* 36/16 */

border-radius: 0;
padding: 0 calc(var(--e-wpkit-search-full-screen--field-pe) + 0.625rem) var(--e-wpkit-search-field-gutter-y) 0;
min-height: calc(var(--e-wpkit-search-full-screen--field-height) + var(--e-wpkit-search-field-gutter-y));
border: 0;
border-bottom: 2px solid #000;
background: transparent;

}

.search-submit {

color: var(--e-wpkit-search-full-screen--submit, #333);
font-size: var(--e-wpkit-search-full-screen--submit-size, 2.25rem); /* 36/16 */
border: none;
padding: 0;
position: absolute;
top: 0;
right: 0;
z-index: 10;

&:hover {
opacity: .72;
background: transparent;
}

&:focus {
outline: 0;
}

&__text {
@extend .screen-reader-text;
}

}
}

}
Loading

0 comments on commit c87ece1

Please sign in to comment.