Skip to content
Snippets Groups Projects
Commit 07f23fcb authored by Jack Reed's avatar Jack Reed
Browse files

Adds a new add/wrap plugin area in the top bar for more expansive

choices
parent 34c117af
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,12 @@ ...@@ -49,6 +49,12 @@
) )
} }
const AddPluginComponentE = (props) => (
<div id="add-plugin-component-e">
<input value="hello world"/>
</div>
);
const addPluginA = { const addPluginA = {
target: 'WorkspaceControlPanelButtons', target: 'WorkspaceControlPanelButtons',
mode: 'add', mode: 'add',
...@@ -73,7 +79,13 @@ ...@@ -73,7 +79,13 @@
component: WrapPluginComponent, component: WrapPluginComponent,
}; };
const miradorInstance = Mirador.viewer(config, [addPluginA, addPluginB, addPluginC, wrapPluginD]); const addPluginE = {
target: 'WindowTopBarPluginArea',
mode: 'add',
component: AddPluginComponentE,
};
const miradorInstance = Mirador.viewer(config, [addPluginA, addPluginB, addPluginC, wrapPluginD, addPluginE]);
</script> </script>
</body> </body>
......
...@@ -5,6 +5,7 @@ import Toolbar from '@material-ui/core/Toolbar'; ...@@ -5,6 +5,7 @@ import Toolbar from '@material-ui/core/Toolbar';
import AppBar from '@material-ui/core/AppBar'; import AppBar from '@material-ui/core/AppBar';
import WindowTopMenuButton from '../../../src/containers/WindowTopMenuButton'; import WindowTopMenuButton from '../../../src/containers/WindowTopMenuButton';
import WindowTopBarPluginArea from '../../../src/containers/WindowTopBarPluginArea';
import WindowTopBarPluginMenu from '../../../src/containers/WindowTopBarPluginMenu'; import WindowTopBarPluginMenu from '../../../src/containers/WindowTopBarPluginMenu';
import WindowTopBarTitle from '../../../src/containers/WindowTopBarTitle'; import WindowTopBarTitle from '../../../src/containers/WindowTopBarTitle';
import MiradorMenuButton from '../../../src/containers/MiradorMenuButton'; import MiradorMenuButton from '../../../src/containers/MiradorMenuButton';
...@@ -35,6 +36,7 @@ describe('WindowTopBar', () => { ...@@ -35,6 +36,7 @@ describe('WindowTopBar', () => {
expect(wrapper.find(Toolbar).length).toBe(1); expect(wrapper.find(Toolbar).length).toBe(1);
expect(wrapper.find(MiradorMenuButton).length).toBe(3); expect(wrapper.find(MiradorMenuButton).length).toBe(3);
expect(wrapper.find(WindowTopBarTitle).length).toBe(1); expect(wrapper.find(WindowTopBarTitle).length).toBe(1);
expect(wrapper.find(WindowTopBarPluginArea).length).toBe(1);
expect(wrapper.find(WindowTopBarPluginMenu).length).toBe(1); expect(wrapper.find(WindowTopBarPluginMenu).length).toBe(1);
expect(wrapper.find(WindowTopMenuButton).length).toBe(1); expect(wrapper.find(WindowTopMenuButton).length).toBe(1);
expect(wrapper.find(FullScreenButton).length).toBe(0); expect(wrapper.find(FullScreenButton).length).toBe(0);
......
import React from 'react';
import { shallow } from 'enzyme';
import { WindowTopBarPluginArea } from '../../../src/components/WindowTopBarPluginArea';
import { PluginHook } from '../../../src/components/PluginHook';
it('renders the component', () => {
const wrapper = shallow(<WindowTopBarPluginArea />);
expect(wrapper.find(PluginHook).length).toBe(1);
});
...@@ -6,6 +6,7 @@ import Toolbar from '@material-ui/core/Toolbar'; ...@@ -6,6 +6,7 @@ import Toolbar from '@material-ui/core/Toolbar';
import AppBar from '@material-ui/core/AppBar'; import AppBar from '@material-ui/core/AppBar';
import classNames from 'classnames'; import classNames from 'classnames';
import WindowTopMenuButton from '../containers/WindowTopMenuButton'; import WindowTopMenuButton from '../containers/WindowTopMenuButton';
import WindowTopBarPluginArea from '../containers/WindowTopBarPluginArea';
import WindowTopBarPluginMenu from '../containers/WindowTopBarPluginMenu'; import WindowTopBarPluginMenu from '../containers/WindowTopBarPluginMenu';
import WindowTopBarTitle from '../containers/WindowTopBarTitle'; import WindowTopBarTitle from '../containers/WindowTopBarTitle';
import MiradorMenuButton from '../containers/MiradorMenuButton'; import MiradorMenuButton from '../containers/MiradorMenuButton';
...@@ -58,6 +59,7 @@ export class WindowTopBar extends Component { ...@@ -58,6 +59,7 @@ export class WindowTopBar extends Component {
{allowTopMenuButton && ( {allowTopMenuButton && (
<WindowTopMenuButton className={ns('window-menu-btn')} windowId={windowId} /> <WindowTopMenuButton className={ns('window-menu-btn')} windowId={windowId} />
)} )}
<WindowTopBarPluginArea windowId={windowId} />
<WindowTopBarPluginMenu windowId={windowId} /> <WindowTopBarPluginMenu windowId={windowId} />
{allowMaximize && ( {allowMaximize && (
<MiradorMenuButton <MiradorMenuButton
......
import React, { Component } from 'react';
import { PluginHook } from './PluginHook';
/**
*
*/
export class WindowTopBarPluginArea extends Component {
/** */
render() {
return (
<>
<PluginHook {...this.props} />
</>
);
}
}
import { compose } from 'redux';
import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core';
import { withPlugins } from '../extend/withPlugins';
import { WindowTopBarPluginArea } from '../components/WindowTopBarPluginArea';
/**
*/
const styles = {};
const enhance = compose(
withTranslation(),
withStyles(styles),
connect(null, null),
withPlugins('WindowTopBarPluginArea'),
);
export default enhance(WindowTopBarPluginArea);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment