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

Use disabled attribute to disable block mover buttons #588

Merged
merged 2 commits into from
May 1, 2017
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
7 changes: 4 additions & 3 deletions editor/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import { connect } from 'react-redux';
import classnames from 'classnames';
import { first, last } from 'lodash';

/**
Expand All @@ -15,14 +14,16 @@ function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast } ) {
return (
<div className="editor-block-mover">
<IconButton
className={ classnames( 'editor-block-mover__control', { 'is-disabled': isFirst } ) }
className="editor-block-mover__control"
onClick={ onMoveUp }
icon="arrow-up-alt2"
disabled={ isFirst }
/>
<IconButton
className={ classnames( 'editor-block-mover__control', { 'is-disabled': isLast } ) }
className="editor-block-mover__control"
onClick={ onMoveDown }
icon="arrow-down-alt2"
disabled={ isLast }
/>
</div>
);
Expand Down
5 changes: 3 additions & 2 deletions editor/components/block-mover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
color: $dark-gray-900;
}

&.is-disabled {
color: $light-gray-100;
&[disabled] {
cursor: default;
color: $light-gray-300;
}

.dashicon {
Expand Down