Enqueue styles on non-WC pages (https://github.com/woocommerce/woocommerce-admin/pull/5419)
* Enqueue styles on non-WC pages * Only load extra styles when navigation is enabled
This commit is contained in:
parent
523eac0131
commit
c0be4ecb56
|
@ -31,11 +31,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
#adminmenu
|
||||
li.toplevel_page_woocommerce.wp-has-submenu.wp-not-current-submenu.opensub:hover::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#woocommerce-embedded-navigation {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
@ -46,14 +41,4 @@
|
|||
// @todo This should be updated to G2.darkGray.primary when possible.
|
||||
background-color: #1e1e1e;
|
||||
}
|
||||
|
||||
body.is-folded #woocommerce-embedded-navigation {
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.toplevel_page_woocommerce ul.wp-submenu {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// Hide elements on non-WooCommerce pages.
|
||||
body.js:not(.has-woocommerce-navigation) {
|
||||
#adminmenu
|
||||
li.toplevel_page_woocommerce.wp-has-submenu.wp-not-current-submenu.opensub:hover::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.toplevel_page_woocommerce ul.wp-submenu {
|
||||
display: none;
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ class Navigation {
|
|||
|
||||
if ( Loader::is_feature_enabled( 'navigation' ) ) {
|
||||
add_action( 'in_admin_header', array( __CLASS__, 'embed_navigation' ) );
|
||||
add_action( 'admin_enqueue_scripts', array( $this, 'maybe_enqueue_scripts' ) );
|
||||
|
||||
Menu::instance()->init();
|
||||
CoreMenu::instance()->init();
|
||||
|
@ -69,4 +70,22 @@ class Navigation {
|
|||
<div id="woocommerce-embedded-navigation"></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts on non-WooCommerce pages.
|
||||
*/
|
||||
public function maybe_enqueue_scripts() {
|
||||
if ( Screen::is_woocommerce_page() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rtl = is_rtl() ? '-rtl' : '';
|
||||
|
||||
wp_enqueue_style(
|
||||
'wc-admin-navigation',
|
||||
Loader::get_url( "navigation/style{$rtl}", 'css' ),
|
||||
array(),
|
||||
Loader::get_file_version( 'css' )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue