Skip to content

Commit

Permalink
Merge pull request #383 from WordPress/add/toolbar-icons
Browse files Browse the repository at this point in the history
Toolbar polish
  • Loading branch information
aduth committed Apr 7, 2017
2 parents 3408d9e + 497e8f2 commit f328798
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 17 deletions.
1 change: 1 addition & 0 deletions editor/assets/stylesheets/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ $editor-font: "Noto Serif", serif;
$editor-html-font: Menlo, Consolas, monaco, monospace;
$editor-font-size: 16px;
$editor-line-height: 1.8em;
$item-spacing: 10px;
21 changes: 21 additions & 0 deletions editor/components/button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* External dependencies
*/
import './style.scss';
import classnames from 'classnames';

function Button( { type = 'button', isPrimary, isLarge, className, children } ) {
const classes = classnames( 'editor-button', className, {
button: ( isPrimary || isLarge ),
'button-primary': isPrimary,
'button-large': isLarge
} );

return (
<button type={ type } className={ classes }>
{ children }
</button>
);
}

export default Button;
4 changes: 4 additions & 0 deletions editor/components/button/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.editor-button {
background: none;
border: none;
}
16 changes: 16 additions & 0 deletions editor/components/icon-button/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Internal dependencies
*/
import './style.scss';
import Button from '../button';
import Dashicon from '../dashicon';

function IconButton( { icon, label } ) {
return (
<Button title={ label } className="editor-icon-button">
<Dashicon icon={ icon } />
</Button>
);
}

export default IconButton;
14 changes: 14 additions & 0 deletions editor/components/icon-button/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.editor-icon-button {
display: flex;
align-items: center;
width: 36px;
height: 36px;
border: none;
background: none;
color: $dark-gray-500;
cursor: pointer;

&:hover {
color: $blue-medium;
}
}
4 changes: 4 additions & 0 deletions editor/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
*/
import './style.scss';
import ModeSwitcher from './mode-switcher';
import SavedState from './saved-state';
import Tools from './tools';

function Header() {
return (
<header className="editor-header">
<ModeSwitcher />
<SavedState />
<Tools />
</header>
);
}
Expand Down
3 changes: 2 additions & 1 deletion editor/header/mode-switcher/style.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.editor-mode-switcher {
position: relative;
margin-right: $item-spacing;
}

.editor-mode-switcher__toggle {
color: $dark-gray-500;
padding: 8px;
padding: $item-spacing;
align-items: center;
cursor: pointer;
border: none;
Expand Down
16 changes: 16 additions & 0 deletions editor/header/saved-state/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Internal dependencies
*/
import './style.scss';
import Dashicon from '../../components/dashicon';

function SavedState() {
return (
<div className="editor-saved-state">
<Dashicon icon="yes" />
{ wp.i18n.__( 'Saved' ) }
</div>
);
}

export default SavedState;
9 changes: 9 additions & 0 deletions editor/header/saved-state/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.editor-saved-state {
display: flex;
align-items: center;
margin-right: $item-spacing;

.dashicon {
margin-right: 4px;
}
}
2 changes: 1 addition & 1 deletion editor/header/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.editor-header {
height: 56px;
padding: 10px;
padding: $item-spacing;
border-bottom: 1px solid $light-gray-500;
display: flex;
flex-direction: row;
Expand Down
32 changes: 32 additions & 0 deletions editor/header/tools/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Internal dependencies
*/
import './style.scss';
import Dashicon from '../../components/dashicon';
import IconButton from '../../components/icon-button';
import Button from '../../components/button';

function Tools() {
return (
<div className="editor-tools">
<IconButton icon="undo" label={ wp.i18n.__( 'Undo' ) } />
<IconButton icon="redo" label={ wp.i18n.__( 'Redo' ) } />
<IconButton icon="plus-alt" label={ wp.i18n.__( 'Insert block' ) } />
<div className="editor-tools__tabs">
<Button>
<Dashicon icon="visibility" />
{ wp.i18n._x( 'Preview', 'imperative verb' ) }
</Button>
<Button>
<Dashicon icon="admin-generic" />
{ wp.i18n.__( 'Post Settings' ) }
</Button>
</div>
<Button isPrimary isLarge>
{ wp.i18n.__( 'Publish' ) }
</Button>
</div>
);
}

export default Tools;
32 changes: 32 additions & 0 deletions editor/header/tools/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.editor-tools {
margin: 0 0 0 auto;
display: flex;
align-items: center;
}

.editor-tools__tabs {
margin: 0 $item-spacing;
padding: 0 0 0 $item-spacing;
border-left: 1px solid $light-gray-500;
border-right: 1px solid $light-gray-500;
display: flex;
align-items: center;

.editor-button {
display: flex;
align-items: center;
border: none;
background: none;
color: $dark-gray-500;
margin-right: $item-spacing;
cursor: pointer;

&:hover {
color: $blue-medium;
}
}

.editor-button .dashicon {
margin-right: 4px;
}
}
2 changes: 1 addition & 1 deletion editor/inserter/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class InserterButton extends wp.element.Component {
type="button"
aria-label={ wp.i18n.__( 'Add a block' ) }
>
<Dashicon icon="plus" />
<Dashicon icon="plus-alt" />
</button>
{ opened && <Inserter /> }
</div>
Expand Down
23 changes: 9 additions & 14 deletions editor/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,22 @@
}

.editor-inserter__button-toggle {
display: inline-block;
display: inline-flex;
justify-content: center;
align-items: center;
color: $dark-gray-500;
background: none;
cursor: pointer;
border-radius: 50%;
border: 2px solid $dark-gray-500;
width: 26px;
height: 26px;
padding: 0;
margin: 0;
border: none;
width: 36px;
height: 36px;
outline: none;
transition: color .2s ease, border-color .2s ease;

.dashicons {
line-height: 24px;
text-align: center;
}
padding: 0;
margin: 0 0 15px 15px;
transition: color .2s ease;

&:hover {
color: #00aadc;
border-color: #00aadc;
}
}

Expand Down
29 changes: 29 additions & 0 deletions languages/gutenberg.pot
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@ msgstr ""
msgid "Switch the editor mode"
msgstr ""

#: editor/header/saved-state/index.js:11
msgid "Saved"
msgstr ""

#: editor/header/tools/index.js:12
msgid "Undo"
msgstr ""

#: editor/header/tools/index.js:13
msgid "Redo"
msgstr ""

#: editor/header/tools/index.js:14
msgid "Insert block"
msgstr ""

#: editor/header/tools/index.js:18
msgctxt "imperative verb"
msgid "Preview"
msgstr ""

#: editor/header/tools/index.js:22
msgid "Post Settings"
msgstr ""

#: editor/header/tools/index.js:26
msgid "Publish"
msgstr ""

#: editor/inserter/button.js:31
msgid "Add a block"
msgstr ""
Expand Down

0 comments on commit f328798

Please sign in to comment.