Skip to content

Commit

Permalink
TH-6: Theme Editor > Mobile burger menu color is not configurable (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedJamoun authored Aug 7, 2024
1 parent d7b2853 commit 94376eb
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 42 deletions.
6 changes: 1 addition & 5 deletions themes/aura/assets/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@
max-width: 120px;
}
}
@media screen and (max-width: 767px) {
.yc-header .yc-navbar .menu, .yc-header .yc-navbar .menu-toggler {
height: 30px;
}
}

@media (min-width: 768px) {
.yc-header .yc-navbar .menu-toggler {
display: none;
Expand Down
103 changes: 82 additions & 21 deletions themes/aura/sections/main-navbar.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
.toggle-navbar {
display: {{ section.settings.toggle_navbar ? 'none' : 'block' }};
}

.menu .menu-toggler {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background-color: var(--background-color);
border-radius: var(--border-radius);
transform: scale(calc(var(--size) / 100));
}

.menu .menu-toggler ion-icon {
color: var(--color) !important;
}
{% endstyle %}

{% if section.settings.toggle_navbar != true %}
Expand All @@ -42,7 +58,19 @@
</a>
</div>
{%- when 'menu' %}
<div class='menu'>
<div
class='menu'
style='
--background-color: {{ block.settings.navbar_menu_background_color.hex }};
--border-radius: {{ block.settings.navbar_menu_border_radius }}%;
--color:{%- if block.settings.navbar_menu_icon_color.hex -%}
{{ block.settings.navbar_menu_icon_color.hex }}
{%- else -%}
var(--yc-nav-links-color)
{%- endif -%};
--size: {{ block.settings.navbar_menu_size }};
'
>
<button
class='menu-toggler text-3xl'
onclick="openDrawer('.navbar-drawer')"
Expand Down Expand Up @@ -113,25 +141,25 @@
>
</a>
</div>
<form
action='/search'
method='GET'
class='mobile-search w-full flex gap-1 items-center'
>
<input
placeholder='{{ 'navbar.search.placeholder' | t }}'
type='text'
name='q'
value=''
class='w-full'
>
<button
type='submit'
aria-label='search'
>
<ion-icon name="search-outline" class="search-icon"></ion-icon>
</button>
</form>
<form
action='/search'
method='GET'
class='mobile-search w-full flex gap-1 items-center'
>
<input
placeholder='{{ 'navbar.search.placeholder' | t }}'
type='text'
name='q'
value=''
class='w-full'
/>
<button
type='submit'
aria-label='search'
>
<ion-icon name="search-outline" class="search-icon"></ion-icon>
</button>
</form>
<div class='flex flex-col items-wrapper'>
{% for item in main-link-list.links %}
<a
Expand Down Expand Up @@ -161,7 +189,40 @@
{
"label": "Menu",
"limit": 1,
"type": "menu"
"type": "menu",
"settings": [
{
"type": "color",
"id": "navbar_menu_background_color",
"label": "Background color",
"default": "#00000000"
},
{
"type": "color",
"id": "navbar_menu_icon_color",
"label": "Icon color"
},
{
"type": "range",
"id": "navbar_menu_size",
"min": 1,
"step": 1,
"max": 200,
"unit": "%",
"label": "Size",
"default": 100
},
{
"type": "range",
"id": "navbar_menu_border_radius",
"min": 0,
"step": 1,
"max": 50,
"unit": "%",
"label": "Border radius",
"default": 0
}
]
},
{
"label": "Search and cart",
Expand Down
6 changes: 1 addition & 5 deletions themes/harmony/assets/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@
max-width: 120px;
}
}
@media screen and (max-width: 767px) {
.yc-header .yc-navbar .menu, .yc-header .yc-navbar .menu-toggler {
height: 30px;
}
}

.yc-header .yc-navbar .menu-list {
display: none;
list-style: none;
Expand Down
65 changes: 63 additions & 2 deletions themes/harmony/sections/main-navbar.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@
.toggle-navbar {
display: {{ section.settings.toggle_navbar ? 'none' : 'block' }};
}

.menu .menu-toggler {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background-color: var(--background-color);
border-radius: var(--border-radius);
transform: scale(calc(var(--size) / 100));
}

.menu .menu-toggler ion-icon {
color: var(--color) !important;
}
{% endstyle %}

{% if section.settings.toggle_navbar != true %}
Expand All @@ -42,7 +58,19 @@
</a>
</div>
{%- when 'menu' %}
<div class='menu'>
<div
class='menu'
style='
--background-color: {{ block.settings.navbar_menu_background_color.hex }};
--border-radius: {{ block.settings.navbar_menu_border_radius }}%;
--color:{%- if block.settings.navbar_menu_icon_color.hex -%}
{{ block.settings.navbar_menu_icon_color.hex }}
{%- else -%}
var(--yc-neutral-color)
{%- endif -%};
--size: {{ block.settings.navbar_menu_size }};
'
>
<button
class='menu-toggler text-3xl'
onclick="openDrawer('.navbar-drawer')"
Expand Down Expand Up @@ -176,7 +204,40 @@
{
"label": "Menu",
"limit": 1,
"type": "menu"
"type": "menu",
"settings": [
{
"type": "color",
"id": "navbar_menu_background_color",
"label": "Background color",
"default": "#00000000"
},
{
"type": "color",
"id": "navbar_menu_icon_color",
"label": "Icon color"
},
{
"type": "range",
"id": "navbar_menu_size",
"min": 1,
"step": 1,
"max": 200,
"unit": "%",
"label": "Size",
"default": 100
},
{
"type": "range",
"id": "navbar_menu_border_radius",
"min": 0,
"step": 1,
"max": 50,
"unit": "%",
"label": "Border radius",
"default": 0
}
]
},
{
"label": "Search and cart",
Expand Down
2 changes: 1 addition & 1 deletion themes/meraki/assets/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
/* ----------------------------- */
@media (min-width: 768px) {
.hamburger {
display: none;
display: none !important;
}
}
.hamburger .bar {
Expand Down
77 changes: 70 additions & 7 deletions themes/meraki/sections/main-navbar.liquid
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ 'navbar.css' | asset_url | stylesheet_tag }}

{% style %}
:root{
:root {
--yc-nav-height: {{ section.settings.navbar_height }}px;
--yc-nav-background: {{ section.settings.navbar_background_color.hex }};
--yc-nav-links-color: {%- if section.settings.navbar_links_color -%}
Expand All @@ -19,6 +19,22 @@
.toggle-navbar {
display: {{ section.settings.toggle_navbar ? 'none' : 'block' }};
}

.menu #menuButton {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background-color: var(--background-color);
border-radius: var(--border-radius);
transform: scale(calc(var(--size) / 100));
}

.menu #menuButton .bar {
background-color: var(--color);
}
{% endstyle %}

{% if section.settings.toggle_navbar != true %}
Expand All @@ -43,11 +59,25 @@
</a>
</div>
{%- when 'menu' %}
<div class='menu'>
<button id="menuButton" class='hamburger' aria-label='open menu'>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div
class='menu'
style='
--background-color: {{ block.settings.navbar_menu_background_color.hex }};
--border-radius: {{ block.settings.navbar_menu_border_radius }}%;
--color:{%- if block.settings.navbar_menu_icon_color.hex -%}
{{ block.settings.navbar_menu_icon_color.hex }}
{%- else -%}
var(--yc-nav-links-color)
{%- endif -%};
--size: {{ block.settings.navbar_menu_size }};
'
>
<button id="menuButton" class='hamburger'>
<div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
</button>
<ul class='menu-list'>
{% for item in main-link-list.links %}
Expand Down Expand Up @@ -128,7 +158,40 @@
{
"label": "Menu",
"limit": 1,
"type": "menu"
"type": "menu",
"settings": [
{
"type": "color",
"id": "navbar_menu_background_color",
"label": "Background color",
"default": "#00000000"
},
{
"type": "color",
"id": "navbar_menu_icon_color",
"label": "Icon color"
},
{
"type": "range",
"id": "navbar_menu_size",
"min": 1,
"step": 1,
"max": 200,
"unit": "%",
"label": "Size",
"default": 100
},
{
"type": "range",
"id": "navbar_menu_border_radius",
"min": 0,
"step": 1,
"max": 50,
"unit": "%",
"label": "Border radius",
"default": 0
}
]
},
{
"label": "Search and cart",
Expand Down
2 changes: 1 addition & 1 deletion themes/meraki/styles/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@

.hamburger {
@include breakpoint('md') {
display: none;
display: none !important;
}

.bar {
Expand Down

0 comments on commit 94376eb

Please sign in to comment.