-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spike to convert the window top bar to the material framework; part of …
- Loading branch information
Showing
22 changed files
with
415 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { store } from '../../../src/store'; | ||
import { WindowSideBar } from '../../../src/components/WindowSideBar'; | ||
|
||
describe('WindowSideBar', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<WindowSideBar store={store} windowId="1" classes={{}} />); | ||
}); | ||
|
||
it('renders without an error', () => { | ||
expect(wrapper.find('WithStyles(Drawer)').length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { store } from '../../../src/store'; | ||
import { WindowSideBarButtons } from '../../../src/components/WindowSideBarButtons'; | ||
|
||
describe('WindowSideBarButtons', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<WindowSideBarButtons store={store} />); | ||
}); | ||
|
||
it('renders without an error', () => { | ||
expect(wrapper.find('Fragment').length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { store } from '../../../src/store'; | ||
import { WindowTopBarButtons } from '../../../src/components/WindowTopBarButtons'; | ||
|
||
describe('WindowTopBarButtons', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<WindowTopBarButtons store={store} />); | ||
}); | ||
|
||
it('renders without an error', () => { | ||
expect(wrapper.find('Fragment').length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
__tests__/src/components/WorkspaceControlPanelButtons.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { store } from '../../../src/store'; | ||
import { WorkspaceControlPanelButtons } from '../../../src/components/WorkspaceControlPanelButtons'; | ||
|
||
describe('WorkspaceControlPanelButtons', () => { | ||
let wrapper; | ||
beforeEach(() => { | ||
wrapper = shallow(<WorkspaceControlPanelButtons store={store} />); | ||
}); | ||
|
||
it('renders without an error', () => { | ||
expect(wrapper.find('Fragment').length).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React, { Component, Fragment } from 'react'; | ||
import classNames from 'classnames'; | ||
import { connect } from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Drawer from '@material-ui/core/Drawer'; | ||
import miradorWithPlugins from '../lib/miradorWithPlugins'; | ||
|
||
/** | ||
* CompanionWindow | ||
*/ | ||
class CompanionWindow extends Component { | ||
/** | ||
* render | ||
* @return | ||
*/ | ||
render() { | ||
const { windowId, classes, anchor } = this.props; | ||
|
||
return ( | ||
<Drawer | ||
variant="permanent" | ||
className={classNames(classes.drawer)} | ||
classes={{ paper: classNames(classes.drawer) }} | ||
open | ||
anchor={anchor} | ||
PaperProps={{ style: { position: 'absolute' } }} | ||
BackdropProps={{ style: { position: 'absolute' } }} | ||
ModalProps={{ | ||
container: document.getElementById(windowId), | ||
style: { position: 'absolute' }, | ||
}} | ||
> | ||
<div className={classes.toolbar} /> | ||
<Fragment /> | ||
</Drawer> | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* mapDispatchToProps - used to hook up connect to action creators | ||
* @memberof ManifestListItem | ||
* @private | ||
*/ | ||
const mapDispatchToProps = dispatch => ({ | ||
}); | ||
|
||
CompanionWindow.propTypes = { | ||
windowId: PropTypes.string.isRequired, | ||
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types, | ||
anchor: PropTypes.string, | ||
}; | ||
|
||
CompanionWindow.defaultProps = { | ||
anchor: 'left', | ||
}; | ||
|
||
/** | ||
Override drawer styles to make a companion window | ||
@private | ||
*/ | ||
const styles = theme => ({ | ||
drawer: { | ||
overflowX: 'hidden', | ||
flexShrink: 0, | ||
whiteSpace: 'nowrap', | ||
zIndex: theme.zIndex.appBar - 2, | ||
paddingLeft: 60, | ||
}, | ||
grow: { | ||
flexGrow: 1, | ||
}, | ||
toolbar: theme.mixins.toolbar, | ||
}); | ||
|
||
export default connect(null, mapDispatchToProps)(miradorWithPlugins( | ||
withStyles(styles)(CompanionWindow), | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.