Skip to content

Instantly share code, notes, and snippets.

@ockham
Created February 1, 2016 22:15
Show Gist options
  • Save ockham/77214025d2c66a7691f7 to your computer and use it in GitHub Desktop.
Save ockham/77214025d2c66a7691f7 to your computer and use it in GitHub Desktop.
diff --git a/client/layout/logged-out-design.jsx b/client/layout/logged-out-design.jsx
index bbc86cf..1e55722 100644
--- a/client/layout/logged-out-design.jsx
+++ b/client/layout/logged-out-design.jsx
@@ -4,6 +4,8 @@
* External dependencies
*/
import React from 'react';
+import classNames from 'classnames';
+import { connect } from 'react-redux';
/**
* Internal dependencies
@@ -11,21 +13,35 @@ import React from 'react';
import MasterbarMinimal from 'layout/masterbar/minimal';
import ThemesHead from 'my-sites/themes/head';
-const LayoutLoggedOutDesign = ( { tier = 'all' } ) => (
- <div className="wp is-section-design has-no-sidebar">
- <ThemesHead tier={ tier } />
- <MasterbarMinimal url="/" />
- <div id="content" className="wp-content">
- <div id="primary" className="wp-primary wp-section" />
- <div id="secondary" className="wp-secondary" />
+const LayoutLoggedOutDesign = ( { section, hasSidebar, tier = 'all' } ) => {
+ const sectionClass = section ? ' is-section-' + section : '';
+ const classes = classNames( 'wp', sectionClass, {
+ 'has-no-sidebar': ! hasSidebar
+ } );
+
+ return (
+ <div className={ classes }>
+ <ThemesHead tier={ tier } />
+ <MasterbarMinimal url="/" />
+ <div id="content" className="wp-content">
+ <div id="primary" className="wp-primary wp-section" />
+ <div id="secondary" className="wp-secondary" />
+ </div>
+ <div id="tertiary" className="wp-overlay fade-background" />
</div>
- <div id="tertiary" className="wp-overlay fade-background" />
- </div>
-)
+ );
+}
LayoutLoggedOutDesign.displayName = 'LayoutLoggedOutDesign';
LayoutLoggedOutDesign.propTypes = {
+ section: React.PropTypes.string,
+ hasSidebar: React.PropTypes.bool,
tier: React.PropTypes.string
}
-export default LayoutLoggedOutDesign;
+export default connect(
+ ( state ) => {
+ const { section, hasSidebar } = state.ui;
+ return { section, hasSidebar };
+ }
+)( LayoutLoggedOutDesign );
diff --git a/server/pages/index.js b/server/pages/index.js
index 973ae2b..0c32dd3 100644
--- a/server/pages/index.js
+++ b/server/pages/index.js
@@ -17,7 +17,9 @@ var config = require( 'config' ),
sanitize = require( 'sanitize' ),
utils = require( 'bundler/utils' ),
sections = require( '../../client/sections' ),
- i18n = require( 'lib/mixins/i18n');
+ i18n = require( 'lib/mixins/i18n'),
+ createReduxStore = require( 'state' ).createReduxStore,
+ setSection = require( 'state/ui/actions' ).setSection;
var cachedDesignMarkup = {};
@@ -396,6 +398,9 @@ module.exports = function() {
: 'all';
if ( config.isEnabled( 'server-side-rendering' ) ) {
+ const reduxStore = createReduxStore();
+ reduxStore.dispatch( setSection( 'design', { hasSidebar: false } ) );
+
try {
if ( ! cachedDesignMarkup[ tier ] ) {
const cached = cachedDesignMarkup[ tier ] = {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment