Skip to content

Commit

Permalink
Merge pull request #2445 from WordPress/try/compact-save-indicator
Browse files Browse the repository at this point in the history
Try a more compact save state indicator
  • Loading branch information
jasmussen authored Aug 18, 2017
2 parents f777f79 + cbbd5dd commit d5f1b04
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
5 changes: 3 additions & 2 deletions editor/header/mode-switcher/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#wpbody .editor-mode-switcher { /* #wpbody for extra specificity */
#wpbody .editor-mode-switcher { // #wpbody for extra specificity
position: relative;
margin-right: $item-spacing;
padding-right: $item-spacing;
margin-left: -8px; // use the full hit area of the select box, but maintain optical editor bar padding
padding-right: 2px;
color: $dark-gray-500;
align-items: center;
cursor: pointer;
Expand Down
3 changes: 2 additions & 1 deletion editor/header/saved-state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export function SavedState( { isNew, isPublished, isDirty, isSaving, isSaveable,

return (
<Button className={ classnames( className, 'button-link' ) } onClick={ onClick }>
{ __( 'Save Draft' ) }
<span className="editor-saved-state__mobile">{ __( 'Save' ) }</span>
<span className="editor-saved-state__desktop">{ __( 'Save Draft' ) }</span>
</Button>
);
}
Expand Down
14 changes: 14 additions & 0 deletions editor/header/saved-state/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

.dashicon {
margin-right: 4px;
margin-left: -4px;
}

&.button-link {
Expand All @@ -21,3 +22,16 @@
}
}
}

.editor-saved-state__mobile {
@include break-small {
display: none;
}
}

.editor-saved-state__desktop {
display: none;
@include break-small {
display: inline;
}
}
4 changes: 2 additions & 2 deletions editor/header/saved-state/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe( 'SavedState', () => {
);

expect( wrapper.name() ).toBe( 'Button' );
expect( wrapper.childAt( 0 ).text() ).toBe( 'Save Draft' );
expect( wrapper.childAt( 0 ).text() ).toBe( 'Save' );
wrapper.simulate( 'click' );
expect( statusSpy ).toHaveBeenCalledWith( 'draft' );
expect( saveSpy ).toHaveBeenCalled();
Expand All @@ -87,7 +87,7 @@ describe( 'SavedState', () => {
);

expect( wrapper.name() ).toBe( 'Button' );
expect( wrapper.childAt( 0 ).text() ).toBe( 'Save Draft' );
expect( wrapper.childAt( 0 ).text() ).toBe( 'Save' );
wrapper.simulate( 'click' );
expect( statusSpy ).not.toHaveBeenCalled();
expect( saveSpy ).toHaveBeenCalled();
Expand Down

0 comments on commit d5f1b04

Please sign in to comment.