Skip to content

Commit

Permalink
Replace all usages of isFeatureActive( state, 'fixedToolbar' ) with t…
Browse files Browse the repository at this point in the history
…he new hasFixedToolbar selector.

The hasFixedToolbar selector besides taking in consideration if feature is active or not also takes in consideration that in mobile the feature should always be disabled.
  • Loading branch information
jorgefilipecosta committed Jan 4, 2018
1 parent 0482065 commit 91f71ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions editor/edit-post/header/fixed-toolbar-toggle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MenuItemsGroup, MenuItemsToggle, withInstanceId } from '@wordpress/comp
/**
* Internal Dependencies
*/
import { isFeatureActive, isMobile } from '../../../store/selectors';
import { hasFixedToolbar, isMobile } from '../../../store/selectors';
import { toggleFeature } from '../../../store/actions';

function FeatureToggle( { onToggle, active, onMobile } ) {
Expand All @@ -34,7 +34,7 @@ function FeatureToggle( { onToggle, active, onMobile } ) {

export default connect(
( state ) => ( {
active: ! isFeatureActive( state, 'fixedToolbar' ),
active: hasFixedToolbar( state ),
onMobile: isMobile( state ),
} ),
( dispatch, ownProps ) => ( {
Expand Down
8 changes: 4 additions & 4 deletions editor/edit-post/header/header-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
MultiBlocksSwitcher,
} from '../../../components';
import NavigableToolbar from '../../../components/navigable-toolbar';
import { isFeatureActive } from '../../../store/selectors';
import { hasFixedToolbar } from '../../../store/selectors';

function HeaderToolbar( { hasFixedToolbar } ) {
function HeaderToolbar( { fixedToolbarActive } ) {
return (
<NavigableToolbar
className="editor-header-toolbar"
Expand All @@ -34,7 +34,7 @@ function HeaderToolbar( { hasFixedToolbar } ) {
<EditorHistoryRedo />
<TableOfContents />
<MultiBlocksSwitcher />
{ hasFixedToolbar && (
{ fixedToolbarActive && (
<div className="editor-header-toolbar__block-toolbar">
<BlockToolbar />
</div>
Expand All @@ -45,6 +45,6 @@ function HeaderToolbar( { hasFixedToolbar } ) {

export default connect(
( state ) => ( {
hasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),
fixedToolbarActive: hasFixedToolbar( state ),
} )
)( HeaderToolbar );
8 changes: 4 additions & 4 deletions editor/edit-post/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {
} from '../../components';
import {
getEditorMode,
hasFixedToolbar,
hasOpenSidebar,
isSidebarOpened,
isFeatureActive,
} from '../../store/selectors';
import { toggleSidebar } from '../../store/actions';

Expand All @@ -40,12 +40,12 @@ function Layout( {
layoutHasOpenSidebar,
isDefaultSidebarOpened,
isPublishSidebarOpened,
hasFixedToolbar,
fixedToolbarActive,
onToggleSidebar,
} ) {
const className = classnames( 'editor-layout', {
'is-sidebar-opened': layoutHasOpenSidebar,
'has-fixed-toolbar': hasFixedToolbar,
'has-fixed-toolbar': fixedToolbarActive,
} );
const closePublishPanel = () => onToggleSidebar( 'publish', false );

Expand Down Expand Up @@ -82,7 +82,7 @@ export default connect(
layoutHasOpenSidebar: hasOpenSidebar( state ),
isDefaultSidebarOpened: isSidebarOpened( state ),
isPublishSidebarOpened: isSidebarOpened( state, 'publish' ),
hasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),
fixedToolbarActive: hasFixedToolbar( state ),
} ),
{ onToggleSidebar: toggleSidebar }
)( navigateRegions( Layout ) );
4 changes: 2 additions & 2 deletions editor/edit-post/modes/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Component, findDOMNode } from '@wordpress/element';
import './style.scss';
import { BlockList, PostTitle, WritingFlow, DefaultBlockAppender, EditorGlobalKeyboardShortcuts } from '../../../components';
import VisualEditorInserter from './inserter';
import { isFeatureActive } from '../../../store/selectors';
import { hasFixedToolbar } from '../../../store/selectors';
import { clearSelectedBlock } from '../../../store/actions';

class VisualEditor extends Component {
Expand Down Expand Up @@ -72,7 +72,7 @@ class VisualEditor extends Component {
export default connect(
( state ) => {
return {
hasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),
hasFixedToolbar: hasFixedToolbar( state ),
};
},
{
Expand Down

0 comments on commit 91f71ef

Please sign in to comment.