-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Try polishing/simpilfying the header area #5300
Changes from 4 commits
68c4b22
b0d72a0
5984928
4ebd646
2a69d5e
17e5c94
8a1b678
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import { connect } from 'react-redux'; | |
* WordPress dependencies | ||
*/ | ||
import { Component } from '@wordpress/element'; | ||
import { IconButton } from '@wordpress/components'; | ||
import { Button } from '@wordpress/components'; | ||
import { _x } from '@wordpress/i18n'; | ||
|
||
/** | ||
|
@@ -105,14 +105,17 @@ export class PostPreviewButton extends Component { | |
const { link, isSaveable } = this.props; | ||
|
||
return ( | ||
<IconButton | ||
<Button | ||
className="editor-post-preview" | ||
isLarge | ||
href={ link } | ||
onClick={ this.saveForPreview } | ||
target={ this.getWindowTarget() } | ||
icon="visibility" | ||
disabled={ ! isSaveable } | ||
label={ _x( 'Preview', 'imperative verb' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/> | ||
> | ||
{ _x( 'Preview', 'imperative verb' ) } | ||
</Button> | ||
); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,12 @@ | |
* External dependencies | ||
*/ | ||
import { connect } from 'react-redux'; | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Dashicon, Button } from '@wordpress/components'; | ||
import { Dashicon, IconButton } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -43,7 +42,7 @@ export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSavea | |
} | ||
|
||
if ( isPublished ) { | ||
return <PostSwitchToDraftButton className={ classnames( className, 'button-link' ) } />; | ||
return <PostSwitchToDraftButton />; | ||
} | ||
|
||
if ( ! isSaveable ) { | ||
|
@@ -60,10 +59,15 @@ export function PostSavedState( { isNew, isPublished, isDirty, isSaving, isSavea | |
} | ||
|
||
return ( | ||
<Button className={ classnames( className, 'button-link' ) } onClick={ onSave }> | ||
<IconButton | ||
className="editor-post-save-draft" | ||
onClick={ onSave } | ||
icon="cloud-upload" | ||
label={ __( 'Save Draft' ) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was sort of the thinking behind adding this. I still feel like it may not be ideal to have two elements output here, one for mobile, one for desktop, but I can't think of a better way to make a good experience for both. I'll leave the label in and we can revisit if need be. |
||
> | ||
<span className="editor-post-saved-state__mobile">{ __( 'Save' ) }</span> | ||
<span className="editor-post-saved-state__desktop">{ __( 'Save Draft' ) }</span> | ||
</Button> | ||
</IconButton> | ||
); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.editor-post-save-draft { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these overriding styles? If so, wondering if we'd need added specificity in case the styles are applied out of the expected order. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed a fix to remove both this style, and the style it was (yes) overriding. The code it overrode was this: https://github.com/WordPress/gutenberg/blob/master/components/icon-button/style.scss#L10 — the idea being that an icon button can have a label, but on mobile it should always just be the icon only. By applying a width and then removing that width past the mobile breakpoint, the labels would become visible as soon as there was screen realestate. Smarts that I thought were useful for the IconButton component. But perhaps that was too smart. In the case of this PR, I wanted the Save label to be visible even on mobile, as the icon can't stand on its own, and the autosave feature isn't yet on par with other web-apps so you still need to press that button every once in a while. Also, removing the width doesn't seem to have had any negative effects as far as I can tell. So I removed it. |
||
width: auto; | ||
} | ||
|
||
.editor-post-saved-state { | ||
display: flex; | ||
align-items: center; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values changed because the existing cloud was moved upwards 1px to better align with text.