styled menus for mobile devices

This commit is contained in:
jorge-vitrubio 2023-01-14 19:03:04 +01:00
parent c9c2ca8041
commit 4b4e205312
8 changed files with 986 additions and 425 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@
</div><!-- .site-branding -->
<nav id="site-navigation-main" class="main-navigation">
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false"><?php esc_html_e( 'Menu XarxaProd', 'ofisuport' ); ?></button>
<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false" style="background-image: url('<?php echo esc_url( wp_get_attachment_url( get_theme_mod( 'custom_logo' ) ) ); ?>');" ><?php esc_html_e( 'Menu XarxaProd', 'ofisuport' ); ?></button>
<?php
wp_nav_menu(
array(

View File

@ -18,6 +18,176 @@
margin: 0;
padding-left: 0;
ul.sub-menu {
padding-top: 0.5rem;
padding-left: 1rem;
}
}
li {
position: relative;
&:hover > a,
&.focus > a {
}
}
a {
display: flex;
align-items: center;
min-height: 100%;
padding: 0 0.5rem;
text-decoration: none;
font-size: 1rem;
}
.current_page_item > a,
.current-menu-item > a,
.current_page_ancestor > a,
.current-menu-ancestor > a {
font-weight: bold;
font-family: $font__bold;
border-left: 1px solid $color__black;
}
}
.main-navigation {
a[href^="http://localhost"],
a[href^="http://oficinasuport.xarxaprod.cat"],
a[href^="https://oficinasuport.xarxaprod.cat"]
{
font-family: $font__bold;
border-left: 1px solid $color__black;
}
}
.secondary-navigation {
padding: 0 0 1em 0;
ul {
display: inline-block;
li {
padding: 0.5em 0;
}
}
a {
text-transform: uppercase;
}
}
.menu-item-has-children {
}
/* begin of menu-hidden */
.toggle-secondary-navigation .show-mobile{
display:inherit;
}
.toggle,
.toggled-menu {
display: none;
}
.toggle:checked+.toggled-menu{
display: block;
position: absolute;
left:0;
top:0;
width: 100%;
height: 100vh;
margin-top: 0;
padding: 0 2rem;
background-color: $color__white;
}
.toggle-show {
position: relative;
display: inline-block;
width: 1.8em;
height: 1.4em;
margin-right: 0.3em;
border-top: 0.3em solid $color__black;
border-bottom: 0.3em solid $color__black;
}
.toggle-show::before {
content: "";
position: absolute;
top: 0.3em;
left: 0;
width: 100%;
border-top: 0.3em solid $color__black;
}
.toggle-hide {
display: flex;
justify-content: end;
padding-right: 4rem;
}
.toggle-hide::after{
content: "x";
padding: 0;
font-size: 3rem;
font-weight: bold;
}
/* end of menu hidden*/
/* Small menu. */
.main-navigation.toggled {
ul {
display: block;
}
.menu-primary-menu-container {
display: inline-block;
position: absolute;
top: 5rem;
left: 0;
width: 100%;
height: calc(100vh - 5rem);
padding: 3rem;
background-color: $color__white;
}
}
.menu-toggle {
display: inline-block;
width: 10rem;
height: 4rem;
margin: 0;
padding: 0;
font-size: 0;
border: none;
background-position: center;
background-repeat: no-repeat;
background-size: contain;
}
}
@media screen and (max-width: 47.99em) {
.site-branding {
display: block;
width: 0px;
height: 0px;
overflow: hidden;
margin: 0;
padding: 0;
}
.menu-primary-menu-container {
text-transform: uppercase;
li {
padding: 0.5rem 0;
}
}
.menu-secondary-menu-container {
padding: 4rem 2rem;
}
}
@media screen and (min-width: 48em) {
.site-branding {
}
.custom-logo {
min-width: 11rem;
margin: 1rem 1rem 1rem 0;
}
.menu-toggle {
display: none;
}
.main-navigation,.secondary-navigation {
ul {
display: flex;
ul {
background-color: $color__white;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
@ -60,155 +230,6 @@
}
}
li {
position: relative;
&:hover > a,
&.focus > a {
}
}
a {
display: flex;
align-items: center;
min-height: 100%;
padding: 0 0.5rem;
text-decoration: none;
font-size: 1rem;
}
.current_page_item > a,
.current-menu-item > a,
.current_page_ancestor > a,
.current-menu-ancestor > a {
font-weight: bold;
font-family: $font__bold;
border-left: 1px solid $color__black;
}
}
.main-navigation {
a[href^="http://localhost"],
a[href^="http://oficinasuport.xarxaprod.cat"],
a[href^="https://oficinasuport.xarxaprod.cat"]
{
font-family: $font__bold;
border-left: 1px solid $color__black;
}
}
.secondary-navigation {
padding: 1em 0;
ul {
display: inline-block;
li {
padding: 0.5em 0;
}
}
a {
text-transform: uppercase;
}
}
.menu-item-has-children {
&::after {
content: "";
display: inline-block;
position: absolute;
top: 40%;
right: 0.3em;
//vertical-align: middle;
//margin: -3em 0 0.5em;
width: 0.3em;
height: 0.3em;
border: 1px solid $color__grey-light;
border-top: none;
border-left: none;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
&:hover {
&::after {
border-color: $color__grey-dark;
}
}
}
/* begin of menu-hidden */
.toogle-secondary-navigation .show-mobile{
display:inherit;
}
.toogle,
.toogled-menu {
display: none;
}
.toogle:checked+.toogled-menu{
display: block;
position: absolute;
left:0;
top:0;
width: 100%;
height: 100vh;
margin-top: 0;
padding: 7em 4em 0 4em;
background-color: $color__white;
}
.toogle-show {
position: relative;
display: inline-block;
width: 1.8em;
height: 1.4em;
margin-right: 0.3em;
border-top: 0.3em solid $color__black;
border-bottom: 0.3em solid $color__black;
}
.toogle-show::before {
content: "";
position: absolute;
top: 0.3em;
left: 0;
width: 100%;
border-top: 0.3em solid $color__black;
}
.toogle-hide {
display: flex;
justify-content: center;
}
.toogle-hide::after{
content: "x";
padding: 0;
font-size: 3rem;
font-weight: bold;
}
/* end of menu hidden*/
/* Small menu. */
.menu-toggle,
.main-navigation.toggled ul {
display: block;
}
.ofisuport-filters {
.ofisuport-filter {
//float: left;
}
}
}
@media screen and (min-width: 48em) {
.site-branding {
}
.custom-logo {
min-width: 11rem;
margin: 1rem 1rem 1rem 0;
}
.menu-toggle {
display: none;
}
.main-navigation,.secondary-navigation {
ul {
display: flex;
}
a {
padding: 0 0.5rem;
}
@ -249,17 +270,42 @@
.secondary-navigation {
padding: 1.5em 0;
}
/*
* css menu toogler
* */
.toogle-secondary-navigation .show-mobile,
.toogle-secondary-navigation .hide-not-mobile{
.menu-item-has-children {
&::after {
content: "";
display: inline-block;
position: absolute;
top: 40%;
right: 0.3em;
//vertical-align: middle;
//margin: -3em 0 0.5em;
width: 0.3em;
height: 0.3em;
border: 1px solid $color__grey-light;
border-top: none;
border-left: none;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
&:hover {
&::after {
border-color: $color__grey-dark;
}
}
}
/*
* css menu toggler
* */
.toggle-secondary-navigation .show-mobile,
.toggle-secondary-navigation .hide-not-mobile{
display: none;
}
.toogled-menu {
.toggled-menu {
display: inherit;
}
/* end css menu toogler
/* end css menu toggler
* */
}
@ -286,8 +332,8 @@
}
@media screen and (min-width: 80em) {
.main-navigation,.secondary-navigation {
.toogle-sidebar-segona .show-mobile,
.toogle-sidebar-segona .hide-not-mobile{
.toggle-sidebar-segona .show-mobile,
.toggle-sidebar-segona .hide-not-mobile{
display:none;
}

View File

@ -33,7 +33,7 @@
box-shadow: 0 15px 30px rgba(0,0,0,0.05), 0 1px 0 0 rgba(0,0,0,0.0);
.main {
display: flex;
flex-flow: row;
flex-flow: column;
align-items: center;
justify-content: space-around;
}
@ -60,6 +60,10 @@
@media screen and (max-width: 48em) {
//only smaller than 48em
.site-header {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0.5rem 0;
align-items: center;
}
.site-main {
}
@ -84,7 +88,7 @@
}
.site-header {
.main {
flex-flow: column;
//flex-flow: column;
}
.secondary {
border-top: 1px solid $color__grey-lighter;

479
style.css

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long