Skip to content

Commit

Permalink
Components: Extract TableOfContents as reusable component
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 24, 2017
1 parent 7b19f4f commit b81cdf6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions editor/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export { default as PostTitle } from './post-title';
export { default as PostTrash } from './post-trash';
export { default as PostVisibility } from './post-visibility';
export { default as PostVisibilityLabel } from './post-visibility/label';
export { default as TableOfContents } from './table-of-contents';
export { default as UnsavedChangesWarning } from './unsaved-changes-warning';
export { default as WordCount } from './word-count';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { Dropdown, IconButton } from '@wordpress/components';
* Internal dependencies
*/
import './style.scss';
import { WordCount, DocumentOutline } from '../../components';
import WordCount from '../word-count';
import DocumentOutline from '../document-outline';
import { getBlocks } from '../../selectors';
import { selectBlock } from '../../actions';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
.table-of-contents {
display: none;

.is-sidebar-opened & {
right: $sidebar-width + 16px;
}

@include break-small() {
display: block;
}
}

.table-of-contents__popover .components-popover__content {
padding: 16px;
}
Expand Down
3 changes: 1 addition & 2 deletions editor/edit-post/header/header-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import { IconButton } from '@wordpress/components';
* Internal dependencies
*/
import './style.scss';
import { Inserter, BlockToolbar } from '../../../components';
import { Inserter, BlockToolbar, TableOfContents } from '../../../components';
import BlockSwitcher from '../../../components/block-switcher';
import NavigableToolbar from '../../../components/navigable-toolbar';
import TableOfContents from '../../table-of-contents';
import { getMultiSelectedBlockUids, hasEditorUndo, hasEditorRedo, isFeatureActive } from '../../../selectors';

function HeaderToolbar( { hasUndo, hasRedo, hasFixedToolbar, undo, redo, isMultiBlockSelection, selectedBlockUids } ) {
Expand Down
12 changes: 12 additions & 0 deletions editor/edit-post/header/header-toolbar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,15 @@
}
}
}

.editor-header-toolbar .table-of-contents {
display: none;

.is-sidebar-opened & {
right: $sidebar-width + 16px;
}

@include break-small() {
display: block;
}
}

0 comments on commit b81cdf6

Please sign in to comment.