Skip to content

Commit

Permalink
Implemented the changes requested in the comments of #4456
Browse files Browse the repository at this point in the history
  • Loading branch information
DanReyLop committed Dec 19, 2016
1 parent 1742241 commit 5eb15f1
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 66 deletions.
4 changes: 2 additions & 2 deletions client/components/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ button {
}

// Primary buttons
@mixin is-primary {
@mixin button-is-primary {
background: $blue-medium;
border-color: darken( $blue-medium, 8% );
color: $white;
Expand All @@ -124,7 +124,7 @@ button {
}

.button.is-primary {
@include is-primary;
@include button-is-primary;
}

// Scary buttons
Expand Down
14 changes: 11 additions & 3 deletions client/post-editor/editor-ground-control/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default React.createClass( {
isSaving: React.PropTypes.bool,
onPreview: React.PropTypes.func,
onPublish: React.PropTypes.func,
onSave: React.PropTypes.func,
onSaveDraft: React.PropTypes.func,
onMoreInfoAboutEmailVerify: React.PropTypes.func,
post: React.PropTypes.object,
Expand Down Expand Up @@ -364,9 +365,16 @@ export default React.createClass( {
</button>
<div className="editor-ground-control__publish-combo">
<EditorPublishButton
{ ...this.props }
needsVerification={ this.state.needsVerification }
site={ this.props.site }
post={ this.props.post }
savedPost={ this.props.savedPost }
onSave={ this.props.onSave }
onPublish={ this.props.onPublish }
tabIndex={ 5 }
isPublishing={ this.props.isPublishing }
isSaveBlocked={ this.props.isSaveBlocked }
hasContent={ this.props.hasContent }
needsVerification={ this.state.needsVerification }
/>
{ this.canSchedulePost() &&
<button
Expand All @@ -386,7 +394,7 @@ export default React.createClass( {
<span className="editor-ground-control__time-button__label">
{ postUtils.isFutureDated( this.props.post )
? this.moment( this.props.post.date ).calendar()
: this.translate( 'Choose date' )
: this.translate( 'Choose Date' )
}
</span>
</button>
Expand Down
2 changes: 1 addition & 1 deletion client/post-editor/editor-ground-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

.editor-ground-control__time-button {
@include breakpoint( ">660px" ) {
@include is-primary;
@include button-is-primary;

border-radius: 0 4px 4px 0;
padding-left: 8px;
Expand Down
73 changes: 37 additions & 36 deletions client/post-editor/editor-mobile-navigation/index.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,33 @@
/**
* External dependencies
*/
<<<<<<< 429330de20f54078095263b712a5032d91979d7a
import React from 'react';
import { connect } from 'react-redux';
=======
import React, { PropTypes } from 'react';
import PureRenderMixin from 'react-pure-render/mixin';
>>>>>>> Moved the primary button to the navigation bar, only in mobile
import { connect } from 'react-redux';
import classnames from 'classnames';

/**
* Internal dependencies
*/
import Gridicon from 'components/gridicon';
<<<<<<< 429330de20f54078095263b712a5032d91979d7a
import { setLayoutFocus } from 'state/ui/layout-focus/actions';

const EditorMobileNavigation = React.createClass( {
=======
import layoutFocus from 'lib/layout-focus';
import EditorPublishButton from 'post-editor/editor-publish-button';
import Button from 'components/button';

export default React.createClass( {
displayName: 'EditorMobileNavigation',
const EditorMobileNavigation = React.createClass( {

propTypes: {
site: PropTypes.object,
post: PropTypes.object,
savedPost: PropTypes.object,
onSave: PropTypes.function,
onPublish: PropTypes.function,
onSave: PropTypes.func,
onPublish: PropTypes.func,
tabIndex: PropTypes.number,
isPublishing: PropTypes.bool,
isSaveBlocked: PropTypes.bool,
hasContent: PropTypes.bool,
onClose: PropTypes.function
onClose: PropTypes.func
},

mixins: [ PureRenderMixin ],
>>>>>>> Moved the primary button to the navigation bar, only in mobile

getInitialState: function() {
return {
sidebarOpen: false
Expand Down Expand Up @@ -69,24 +56,38 @@ export default React.createClass( {
return (
<div className="editor-mobile-navigation">
<div className="editor-mobile-navigation__actions">
<Gridicon
icon="chevron-left"
onClick={ this.props.onClose }
className="editor-mobile-navigation__icon separator-right" />
<Gridicon
icon="pencil"
onClick={ this.closeSidebar }
className={ classnames( 'editor-mobile-navigation__icon', {
'is-selected': ! this.state.sidebarOpen
} ) } />
<Gridicon
icon="cog"
onClick={ this.openSidebar }
className={ classnames( 'editor-mobile-navigation__icon', 'separator-right', {
'is-selected': this.state.sidebarOpen
} ) } />
<Button borderless onClick={ this.props.onClose }>
<Gridicon
icon="chevron-left"
className="editor-mobile-navigation__icon" />
</Button>
<div className="editor-mobile-navigation__tabs">
<Button borderless onClick={ this.closeSidebar }>
<Gridicon
icon="pencil"
className={ classnames( 'editor-mobile-navigation__icon', {
'is-selected': ! this.state.sidebarOpen
} ) } />
</Button>
<Button borderless onClick={ this.openSidebar }>
<Gridicon
icon="cog"
className={ classnames( 'editor-mobile-navigation__icon', {
'is-selected': this.state.sidebarOpen
} ) } />
</Button>
</div>
</div>
<EditorPublishButton { ...this.props } />
<EditorPublishButton
site={ this.props.site }
post={ this.props.post }
savedPost={ this.props.savedPost }
onSave={ this.props.onSave }
onPublish={ this.props.onPublish }
isPublishing={ this.props.isPublishing }
isSaveBlocked={ this.props.isSaveBlocked }
hasContent={ this.props.hasContent }
/>
</div>
);
}
Expand Down
18 changes: 10 additions & 8 deletions client/post-editor/editor-mobile-navigation/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.editor-mobile-navigation {
color: $gray;
display: flex;
justify-content: space-between;
align-items: center;
Expand All @@ -16,21 +15,24 @@
line-height: 0;
}

.editor-mobile-navigation__tabs {
display: inline-block;
border-left: 1px lighten( $gray, 20% ) solid;
border-right: 1px lighten( $gray, 20% ) solid;
}

.editor-mobile-navigation__icon {
cursor: pointer;
padding: 15px;
padding: 4px 12px;
color: lighten( $gray, 10% );

&:hover {
fill: $gray-dark;
color: $gray-dark;
}

&.is-selected {
cursor: default;
fill: $gray-dark;
}

&.separator-right {
border-right: 1px lighten( $gray, 20% ) solid;
color: $gray-dark;
}
}

Expand Down
25 changes: 14 additions & 11 deletions client/post-editor/editor-publish-button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export default React.createClass( {
site: PropTypes.object,
post: PropTypes.object,
savedPost: PropTypes.object,
onSave: PropTypes.function,
onPublish: PropTypes.function,
onSave: PropTypes.func,
onPublish: PropTypes.func,
tabIndex: PropTypes.number,
isPublishing: PropTypes.bool,
isSaveBlocked: PropTypes.bool,
Expand All @@ -31,13 +31,13 @@ export default React.createClass( {
update: 'Clicked Update Post Button',
schedule: 'Clicked Schedule Post Button',
requestReview: 'Clicked Request-Review Post Button',
publish: 'Clicked Publish Post Button',
publish: 'Clicked Publish Post Button'
};
const pageEvents = {
update: 'Clicked Update Page Button',
schedule: 'Clicked Schedule Page Button',
requestReview: 'Clicked Request-Review Page Button',
publish: 'Clicked Publish Page Button',
publish: 'Clicked Publish Page Button'
};
const buttonState = this.getButtonState();
const eventString = postUtils.isPage( this.props.post ) ? pageEvents[ buttonState ] : postEvents[ buttonState ];
Expand Down Expand Up @@ -75,13 +75,16 @@ export default React.createClass( {
},

getButtonLabel: function() {
const buttonLabels = {
update: this.translate( 'Update' ),
schedule: this.translate( 'Schedule' ),
publish: this.translate( 'Publish' ),
requestReview: this.translate( 'Submit for Review' )
};
return buttonLabels[ this.getButtonState() ];
switch ( this.getButtonState() ) {
case 'update':
return this.translate( 'Update' );
case 'schedule':
return this.translate( 'Schedule' );
case 'publish':
return this.translate( 'Publish' );
case 'requestReview':
return this.translate( 'Submit for Review' );
}
},

onClick: function() {
Expand Down
32 changes: 27 additions & 5 deletions client/post-editor/editor-sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default React.createClass( {

propTypes: {
allPostsUrl: PropTypes.string,
sites: PropTypes.array,
sites: PropTypes.object,
onTitleClick: PropTypes.func,
savedPost: PropTypes.object,
post: PropTypes.object,
Expand All @@ -35,7 +35,8 @@ export default React.createClass( {
user: PropTypes.object,
userUtils: PropTypes.object,
type: PropTypes.string,
showDrafts: PropTypes.bool
showDrafts: PropTypes.bool,
onMoreInfoAboutEmailVerify: PropTypes.func
},

render() {
Expand All @@ -53,9 +54,30 @@ export default React.createClass( {
selectedId={ this.props.post ? this.props.post.ID : null }
/>
: <div>
<EditorGroundControl { ...this.props } />
<EditorDrawer { ...this.props } />
<SidebarFooter />
<EditorGroundControl
hasContent={ this.props.hasContent }
isDirty={ this.props.isDirty }
isSaveBlocked={ this.props.isSaveBlocked }
isPublishing={ this.props.isPublishing }
isSaving={ this.props.isSaving }
onPreview={ this.props.onPreview }
onPublish={ this.props.onPublish }
onSave={ this.props.onSave }
onSaveDraft={ this.props.onSaveDraft }
post={ this.props.post }
savedPost={ this.props.savedPost }
site={ this.props.site }
user={ this.props.user }
userUtils={ this.props.userUtils }
type={ this.props.type }
onMoreInfoAboutEmailVerify={ this.props.onMoreInfoAboutEmailVerify }
/>
<EditorDrawer
site={ this.props.site }
post={ this.props.post }
isNew={ this.props.isNew }
type={ this.props.type }
/>
</div> }
</div>
);
Expand Down
1 change: 1 addition & 0 deletions client/post-editor/post-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export const PostEditor = React.createClass( {
userUtils={ this.props.userUtils }
type={ this.props.type }
showDrafts={ this.props.showDrafts }
onMoreInfoAboutEmailVerify={ this.onMoreInfoAboutEmailVerify }
/>
</div>
{ isTrashed
Expand Down

0 comments on commit 5eb15f1

Please sign in to comment.