Skip to content

Commit

Permalink
Merge pull request #770 from Automattic/simplify/mobile-menu
Browse files Browse the repository at this point in the history
Refactor: Simplify the mobile menu files
  • Loading branch information
laurelfulford authored Feb 25, 2020
2 parents b83c15e + 98439e4 commit 43f653d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 47 deletions.
8 changes: 1 addition & 7 deletions newspack-theme/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
<?php do_action( 'wp_body_open' ); ?>
<?php do_action( 'before_header' ); ?>

<?php
if ( newspack_is_amp() ) {
get_template_part( 'template-parts/header/mobile', 'sidebar' );
} else {
get_template_part( 'template-parts/header/mobile', 'sidebar-fallback' );
}
?>
<?php get_template_part( 'template-parts/header/mobile', 'sidebar' ); ?>

<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'newspack' ); ?></a>
Expand Down
26 changes: 0 additions & 26 deletions newspack-theme/template-parts/header/mobile-sidebar-fallback.php

This file was deleted.

38 changes: 24 additions & 14 deletions newspack-theme/template-parts/header/mobile-sidebar.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
<?php
/**
* Template for display the AMP mobile navigation.
* Template to display the mobile navigation, either AMP or fallback.
*
* @package Newspack
*/
?>

<amp-sidebar id="mobile-sidebar" layout="nodisplay" side="right" class="mobile-sidebar">
if ( newspack_is_amp() ) : ?>
<amp-sidebar id="mobile-sidebar" layout="nodisplay" side="right" class="mobile-sidebar">
<button class="mobile-menu-toggle" on='tap:mobile-sidebar.toggle'>
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php else : ?>
<aside id="mobile-sidebar-fallback" class="mobile-sidebar">
<button class="mobile-menu-toggle">
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php endif; ?>

<button class="mobile-menu-toggle" on='tap:mobile-sidebar.toggle'>
<?php echo wp_kses( newspack_get_icon_svg( 'close', 20 ), newspack_sanitize_svgs() ); ?>
<?php esc_html_e( 'Close', 'newspack' ); ?>
</button>
<?php newspack_tertiary_menu(); ?>

<?php newspack_tertiary_menu(); ?>
<?php get_search_form(); ?>

<?php get_search_form(); ?>
<?php newspack_primary_menu(); ?>

<?php newspack_primary_menu(); ?>
<?php newspack_secondary_menu(); ?>

<?php newspack_secondary_menu(); ?>
<?php newspack_social_menu_header(); ?>

<?php newspack_social_menu_header(); ?>

</amp-sidebar>
<?php if ( newspack_is_amp() ) : ?>
</amp-sidebar>
<?php else : ?>
</aside>
<?php endif; ?>

0 comments on commit 43f653d

Please sign in to comment.