Jelajahi Sumber

Update the Barnsbury theme to have the mobile nav on the side.

Enej Bajgoric 4 tahun lalu
induk
melakukan
f5e510dc75

+ 3 - 0
barnsbury/functions.php

@@ -102,6 +102,9 @@ if ( ! function_exists( 'barnsbury_setup' ) ) :
 				),
 			)
 		);
+
+		// Add mobile-on-side body class.
+		add_filter( 'body_class', 'varia_mobile_nav_on_side' );
 	}
 endif;
 add_action( 'after_setup_theme', 'barnsbury_setup', 12 );

+ 30 - 0
barnsbury/sass/_extra-child-theme.scss

@@ -393,3 +393,33 @@ a {
 		margin-top: $spacing_unit;
 	}
 }
+// Updates the Mobile Navigation to be next to the site title.
+.mobile-nav-side .site-title,
+.mobile-nav-side .site-description {
+	@include media(mobile-only) {
+		margin-right: 100px; /** this number is a bit magic. */
+	}
+}
+
+.mobile-nav-side .main-navigation {
+	@include media(mobile-only) {
+		#toggle-menu {
+			position: absolute;
+			top:2 * $baseline-unit;
+			right: 2 * $baseline-unit;
+		}
+
+		.menu-main-menu-container {
+			background: #{map-deep-get($config-global, "color", "background", "light") };
+			margin:0 ( -2 * $baseline-unit );
+			padding: 0 (2 * $baseline-unit) $baseline-unit;
+			.sub-menu {
+				padding-left: 2 * $baseline-unit;  /** todo: variable */
+			}
+			a {
+				padding: $baseline-unit 0;
+				line-height: 1;
+			}
+		}
+	}
+}

+ 29 - 0
barnsbury/style-rtl.css

@@ -4390,3 +4390,32 @@ body.admin-bar .widget_eu_cookie_law_widget.widget.top {
 .wp-block-latest-posts .wp-block-latest-posts__post-full-content {
 	margin-top: 16px;
 }
+
+@media only screen and (max-width: 559px) {
+	.mobile-nav-side .site-title,
+	.mobile-nav-side .site-description {
+		margin-left: 100px;
+		/** this number is a bit magic. */
+	}
+}
+
+@media only screen and (max-width: 559px) {
+	.mobile-nav-side .main-navigation #toggle-menu {
+		position: absolute;
+		top: 16px;
+		left: 16px;
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container {
+		background: #FDF9EC;
+		margin: 0 -16px;
+		padding: 0 16px 8px;
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container .sub-menu {
+		padding-right: 16px;
+		/** todo: variable */
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container a {
+		padding: 8px 0;
+		line-height: 1;
+	}
+}

+ 29 - 0
barnsbury/style.css

@@ -4419,3 +4419,32 @@ body.admin-bar .widget_eu_cookie_law_widget.widget.top {
 .wp-block-latest-posts .wp-block-latest-posts__post-full-content {
 	margin-top: 16px;
 }
+
+@media only screen and (max-width: 559px) {
+	.mobile-nav-side .site-title,
+	.mobile-nav-side .site-description {
+		margin-right: 100px;
+		/** this number is a bit magic. */
+	}
+}
+
+@media only screen and (max-width: 559px) {
+	.mobile-nav-side .main-navigation #toggle-menu {
+		position: absolute;
+		top: 16px;
+		right: 16px;
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container {
+		background: #FDF9EC;
+		margin: 0 -16px;
+		padding: 0 16px 8px;
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container .sub-menu {
+		padding-left: 16px;
+		/** todo: variable */
+	}
+	.mobile-nav-side .main-navigation .menu-main-menu-container a {
+		padding: 8px 0;
+		line-height: 1;
+	}
+}