Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish header for mobile and more languages #5329

Merged
merged 5 commits into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions edit-post/components/header/more-menu/style.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
.edit-post-more-menu {
margin-left: -4px;

// the padding and margin of the more menu is intentionally non-standard
.components-icon-button {
width: auto;
padding: 8px 2px;
}

@include break-small() {
margin-left: 4px;
}

.components-icon-button {
padding: 8px 4px;
width: auto;
.components-icon-button {
padding: 8px 4px;
}
}

.components-button svg {
Expand Down
19 changes: 17 additions & 2 deletions edit-post/components/header/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.edit-post-header {
height: $header-height;
padding: $item-spacing;
padding: $item-spacing 2px;
border-bottom: 1px solid $light-gray-500;
background: $white;
display: flex;
Expand All @@ -19,12 +19,22 @@
// otherwise you can invoke the overscroll bounce on the non-scrolling container, causing (ノಠ益ಠ)ノ彡┻━┻
@include break-small {
position: fixed;
padding: $item-spacing;
top: $admin-bar-height-big;
}

@include break-medium() {
top: $admin-bar-height;
}

.editor-post-switch-to-draft + .editor-post-preview,
.editor-post-switch-to-draft + .editor-post-preview + .editor-post-publish-button {
display: none;

@include break-small {
display: inline-block;
}
}
}

@include editor-left('.edit-post-header');
Expand Down Expand Up @@ -70,7 +80,12 @@
margin: 2px;
height: 33px;
line-height: 32px;
padding: 0 12px 2px;
padding: 0 5px 2px;
font-size: $default-font-size;

@include break-small() {
padding: 0 12px 2px;
}
}

@include break-medium() {
Expand Down
11 changes: 4 additions & 7 deletions editor/components/post-saved-state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ import {
* @return {WPElement} WordPress Element.
*/
export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSaveable, onSave } ) {
const className = 'editor-post-saved-state';

if ( isSaving ) {
return (
<span className={ className }>
<span className="editor-post-saved-state editor-post-saved-state__saving">
<Dashicon icon="cloud" />
{ __( 'Saving' ) }
</span>
);
Expand All @@ -51,7 +50,7 @@ export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSavea

if ( ! isNew && ! isDirty ) {
return (
<span className={ className }>
<span className="editor-post-saved-state">
<Dashicon icon="saved" />
{ __( 'Saved' ) }
</span>
Expand All @@ -63,10 +62,8 @@ export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSavea
className="editor-post-save-draft"
onClick={ onSave }
icon="cloud-upload"
label={ __( 'Save Draft' ) }
>
<span className="editor-post-saved-state__mobile">{ __( 'Save' ) }</span>
<span className="editor-post-saved-state__desktop">{ __( 'Save Draft' ) }</span>
{ __( 'Save Draft' ) }
</IconButton>
);
}
Expand Down
39 changes: 21 additions & 18 deletions editor/components/post-saved-state/style.scss
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
.editor-post-saved-state {
display: flex;
align-items: center;
margin-right: $item-spacing;
color: $dark-gray-500;
overflow: hidden;

.dashicon {
margin-right: 4px;
margin-left: -4px;
display: inline-block;
flex: 0 0 auto;
}
}

.wp-core-ui &.button-link {
margin-right: $item-spacing;
padding: 0;
.editor-post-saved-state,
.editor-post-save-draft {
white-space: nowrap;
padding: 8px 4px;
width: $icon-button-size - 8px;

&:hover {
background: none;
}
.dashicon {
margin-right: 8px;
}
}

.editor-post-saved-state__mobile {
@include break-small {
display: none;
@include break-small() {
padding: 8px;
width: auto;
text-indent: inherit;

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

.editor-post-saved-state__desktop {
display: none;
@include break-small {
display: inline;
}
.editor-post-saved-state__saving {
animation: loading_fade .5s infinite;
}
2 changes: 1 addition & 1 deletion editor/components/post-saved-state/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe( 'PostSavedState', () => {
isSaveable={ false } />
);

expect( wrapper.text() ).toBe( 'Saving' );
expect( wrapper.text() ).toContain( 'Saving' );
} );

it( 'returns null if the post is not saveable', () => {
Expand Down
6 changes: 3 additions & 3 deletions editor/components/post-switch-to-draft-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { connect } from 'react-redux';
/**
* WordPress dependencies
*/
import { IconButton } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -31,14 +31,14 @@ function PostSwitchToDraftButton( { isSaving, isPublished, onClick } ) {
};

return (
<IconButton
<Button
className="editor-post-switch-to-draft"
isLarge
onClick={ onSwitch }
disabled={ isSaving }
>
{ __( 'Switch to Draft' ) }
</IconButton>
</Button>
);
}

Expand Down