Merge pull request woocommerce/woocommerce-admin#2291 from woocommerce/fix/2192-screen-meta-links
Move StoreAlerts below screen meta links on embed pages.
This commit is contained in:
commit
c4a6471e9c
|
@ -9,13 +9,30 @@ import { Provider as SlotFillProvider } from 'react-slot-fill';
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import './stylesheets/_embedded.scss';
|
import './stylesheets/_embedded.scss';
|
||||||
import { EmbedLayout } from './layout';
|
import { EmbedLayout, PrimaryLayout as NoticeArea } from './layout';
|
||||||
import 'store';
|
import 'store';
|
||||||
import 'wc-api/wp-data-store';
|
import 'wc-api/wp-data-store';
|
||||||
|
|
||||||
|
const embeddedRoot = document.getElementById( 'woocommerce-embedded-root' );
|
||||||
|
|
||||||
|
// Render the header.
|
||||||
render(
|
render(
|
||||||
<SlotFillProvider>
|
<SlotFillProvider>
|
||||||
<EmbedLayout />
|
<EmbedLayout />
|
||||||
</SlotFillProvider>,
|
</SlotFillProvider>,
|
||||||
document.getElementById( 'woocommerce-embedded-root' )
|
embeddedRoot
|
||||||
|
);
|
||||||
|
|
||||||
|
embeddedRoot.classList.remove( 'is-embed-loading' );
|
||||||
|
|
||||||
|
// Render notices just above the WP content div.
|
||||||
|
const wpBody = document.getElementById( 'wpbody-content' );
|
||||||
|
const wrap = wpBody.querySelector( '.wrap' );
|
||||||
|
const noticeContainer = document.createElement( 'div' );
|
||||||
|
|
||||||
|
render(
|
||||||
|
<div className="woocommerce-layout">
|
||||||
|
<NoticeArea />
|
||||||
|
</div>,
|
||||||
|
wpBody.insertBefore( noticeContainer, wrap )
|
||||||
);
|
);
|
||||||
|
|
|
@ -24,6 +24,19 @@ import { recordPageView } from 'lib/tracks';
|
||||||
import TransientNotices from './transient-notices';
|
import TransientNotices from './transient-notices';
|
||||||
import StoreAlerts from './store-alerts';
|
import StoreAlerts from './store-alerts';
|
||||||
|
|
||||||
|
export class PrimaryLayout extends Component {
|
||||||
|
render() {
|
||||||
|
const { children } = this.props;
|
||||||
|
return (
|
||||||
|
<div className="woocommerce-layout__primary" id="woocommerce-layout__primary">
|
||||||
|
{ window.wcAdminFeatures[ 'store-alerts' ] && <StoreAlerts /> }
|
||||||
|
<Notices />
|
||||||
|
{ children }
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Layout extends Component {
|
class Layout extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.recordPageViewTrack();
|
this.recordPageViewTrack();
|
||||||
|
@ -60,28 +73,25 @@ class Layout extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isEmbeded, ...restProps } = this.props;
|
const { isEmbedded, ...restProps } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className="woocommerce-layout">
|
<div className="woocommerce-layout">
|
||||||
<Slot name="header" />
|
<Slot name="header" />
|
||||||
<TransientNotices />
|
<TransientNotices />
|
||||||
|
{ ! isEmbedded && (
|
||||||
<div className="woocommerce-layout__primary" id="woocommerce-layout__primary">
|
<PrimaryLayout>
|
||||||
{ window.wcAdminFeatures[ 'store-alerts' ] && <StoreAlerts /> }
|
|
||||||
<Notices />
|
|
||||||
{ ! isEmbeded && (
|
|
||||||
<div className="woocommerce-layout__main">
|
<div className="woocommerce-layout__main">
|
||||||
<Controller { ...restProps } />
|
<Controller { ...restProps } />
|
||||||
</div>
|
</div>
|
||||||
|
</PrimaryLayout>
|
||||||
) }
|
) }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Layout.propTypes = {
|
Layout.propTypes = {
|
||||||
isEmbededLayout: PropTypes.bool,
|
isEmbedded: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export class PageLayout extends Component {
|
export class PageLayout extends Component {
|
||||||
|
@ -104,7 +114,7 @@ export class EmbedLayout extends Component {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Header sections={ wcSettings.embedBreadcrumbs } isEmbedded />
|
<Header sections={ wcSettings.embedBreadcrumbs } isEmbedded />
|
||||||
<Layout isEmbeded />
|
<Layout isEmbedded />
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,40 @@
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#woocommerce-embedded-root.is-embed-loading + #wpbody .wrap {
|
||||||
|
padding-top: $large-header-height + 40;
|
||||||
|
|
||||||
|
@include breakpoint( '782px-960px' ) {
|
||||||
|
padding-top: $medium-header-height + 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include breakpoint( '<782px' ) {
|
||||||
|
padding-top: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#screen-meta,
|
||||||
|
#screen-meta-links {
|
||||||
|
top: $large-header-height;
|
||||||
|
|
||||||
|
@include breakpoint( '782px-960px' ) {
|
||||||
|
top: $medium-header-height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include breakpoint( '<782px' ) {
|
||||||
|
top: $small-header-height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#screen-meta {
|
#screen-meta {
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#screen-meta-links {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.notice {
|
.notice {
|
||||||
margin: 5px 15px 2px;
|
margin: 5px 15px 2px;
|
||||||
padding: 1px 12px;
|
padding: 1px 12px;
|
||||||
|
@ -46,10 +75,14 @@
|
||||||
|
|
||||||
.woocommerce-layout__primary {
|
.woocommerce-layout__primary {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-top: 80px;
|
padding-top: $large-header-height + 20;
|
||||||
|
|
||||||
@include breakpoint( '782px-960px' ) {
|
@include breakpoint( '782px-960px' ) {
|
||||||
padding-top: 60px;
|
padding-top: $medium-header-height + 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include breakpoint( '<782px' ) {
|
||||||
|
padding-top: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ class WC_Admin_Loader {
|
||||||
$sections = self::get_embed_breadcrumbs();
|
$sections = self::get_embed_breadcrumbs();
|
||||||
$sections = is_array( $sections ) ? $sections : array( $sections );
|
$sections = is_array( $sections ) ? $sections : array( $sections );
|
||||||
?>
|
?>
|
||||||
<div id="woocommerce-embedded-root">
|
<div id="woocommerce-embedded-root" class="is-embed-loading">
|
||||||
<div class="woocommerce-layout">
|
<div class="woocommerce-layout">
|
||||||
<div class="woocommerce-layout__header is-embed-loading">
|
<div class="woocommerce-layout__header is-embed-loading">
|
||||||
<h1 class="woocommerce-layout__header-breadcrumbs">
|
<h1 class="woocommerce-layout__header-breadcrumbs">
|
||||||
|
@ -391,9 +391,6 @@ class WC_Admin_Loader {
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="woocommerce-layout__primary is-embed-loading" id="woocommerce-layout__primary">
|
|
||||||
<div id="woocommerce-layout__notice-list" class="woocommerce-layout__notice-list"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue