Commit 243c06d3 authored by Robert Knight's avatar Robert Knight

Update annotator toolbar CSS class names to match conventions

Rename CSS class names for `Toolbar` component to match the component itself.
This component name is really overly generic but at least this brings
the CSS and Preact components into line.

One of the toolbar's classes was applied to a container element created
by `ToolbarController`. This class has been moved to an element created
by the `Toolbar` component for consistency. This means there is an
apparently redundant (no styling, one child) container div when looking
at the DOM structure for the toolbar + bucket bar. This will go away if
the whole sidebar container is made into a single Preact component in
future.
parent cdd0164f
...@@ -14,7 +14,7 @@ import propTypes from 'prop-types'; ...@@ -14,7 +14,7 @@ import propTypes from 'prop-types';
function ToolbarButton({ function ToolbarButton({
buttonRef, buttonRef,
expanded, expanded,
className = 'annotator-toolbar-button', className = 'Toolbar__button',
label, label,
icon, icon,
onClick, onClick,
...@@ -98,10 +98,10 @@ export default function Toolbar({ ...@@ -98,10 +98,10 @@ export default function Toolbar({
useMinimalControls = false, useMinimalControls = false,
}) { }) {
return ( return (
<> <div className="Toolbar">
{useMinimalControls && isSidebarOpen && ( {useMinimalControls && isSidebarOpen && (
<ToolbarButton <ToolbarButton
className="annotator-toolbar__sidebar-close" className="Toolbar__sidebar-close"
label="Close annotation sidebar" label="Close annotation sidebar"
icon="cancel" icon="cancel"
onClick={closeSidebar} onClick={closeSidebar}
...@@ -109,7 +109,7 @@ export default function Toolbar({ ...@@ -109,7 +109,7 @@ export default function Toolbar({
)} )}
{!useMinimalControls && ( {!useMinimalControls && (
<ToolbarButton <ToolbarButton
className="annotator-toolbar__sidebar-toggle" className="Toolbar__sidebar-toggle"
buttonRef={toggleSidebarRef} buttonRef={toggleSidebarRef}
label="Annotation sidebar" label="Annotation sidebar"
icon={isSidebarOpen ? 'caret-right' : 'caret-left'} icon={isSidebarOpen ? 'caret-right' : 'caret-left'}
...@@ -118,7 +118,7 @@ export default function Toolbar({ ...@@ -118,7 +118,7 @@ export default function Toolbar({
/> />
)} )}
{!useMinimalControls && ( {!useMinimalControls && (
<div className="annotator-toolbar-buttonbar"> <div className="Toolbar__buttonbar">
<ToolbarButton <ToolbarButton
label="Show highlights" label="Show highlights"
icon={showHighlights ? 'show' : 'hide'} icon={showHighlights ? 'show' : 'hide'}
...@@ -134,7 +134,7 @@ export default function Toolbar({ ...@@ -134,7 +134,7 @@ export default function Toolbar({
/> />
</div> </div>
)} )}
</> </div>
); );
} }
......
...@@ -24,7 +24,6 @@ export class ToolbarController { ...@@ -24,7 +24,6 @@ export class ToolbarController {
const { createAnnotation, setSidebarOpen, setHighlightsVisible } = options; const { createAnnotation, setSidebarOpen, setHighlightsVisible } = options;
this._container = container; this._container = container;
this._container.className = 'annotator-toolbar';
this._useMinimalControls = false; this._useMinimalControls = false;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// which provides controls for toggling the sidebar, // which provides controls for toggling the sidebar,
// toggling highlights etc. // toggling highlights etc.
.annotator-toolbar { .Toolbar {
position: absolute; position: absolute;
left: -(var.$annotator-toolbar-width); left: -(var.$annotator-toolbar-width);
width: var.$annotator-toolbar-width; width: var.$annotator-toolbar-width;
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
z-index: 2; z-index: 2;
} }
.annotator-toolbar-buttonbar { .Toolbar__buttonbar {
@include layout.vertical-rhythm(5px); @include layout.vertical-rhythm(5px);
margin-top: var.$layout-space--small; margin-top: var.$layout-space--small;
} }
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
} }
// Toolbar button with icon // Toolbar button with icon
.annotator-toolbar-button { .Toolbar__button {
@include annotator-button; @include annotator-button;
@include utils.shadow; @include utils.shadow;
@include utils.border; @include utils.border;
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
} }
// Control to collapse/expand the sidebar // Control to collapse/expand the sidebar
.annotator-toolbar__sidebar-toggle { .Toolbar__sidebar-toggle {
@include annotator-button; @include annotator-button;
@include utils.border--left; @include utils.border--left;
@include utils.border--bottom; @include utils.border--bottom;
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
} }
/** Visible with clean theme */ /** Visible with clean theme */
.annotator-toolbar__sidebar-close { .Toolbar__sidebar-close {
@include buttons.reset-native-btn-styles; @include buttons.reset-native-btn-styles;
@include buttons.button-hover; @include buttons.button-hover;
@include utils.border; @include utils.border;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment