Skip to content
Snippets Groups Projects
Commit 6c382973 authored by Chris Beer's avatar Chris Beer
Browse files

Adjust typography in WindowwSideBarInfoPanel

parent 48cf3e96
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,7 @@ describe('CompanionWindowFactory', () => { ...@@ -23,7 +23,7 @@ describe('CompanionWindowFactory', () => {
content: 'info', content: 'info',
}); });
expect(wrapper.find('WithStyles(Connect(Connect(miradorWithPlugins(WindowSideBarInfoPanel))))').length).toBe(1); expect(wrapper.find('Connect(Connect(miradorWithPlugins(WindowSideBarInfoPanel)))').length).toBe(1);
}); });
}); });
......
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
import Typography from '@material-ui/core/Typography';
import { WindowList } from '../../../src/components/WindowList'; import { WindowList } from '../../../src/components/WindowList';
describe('WindowList', () => { describe('WindowList', () => {
...@@ -51,7 +52,7 @@ describe('WindowList', () => { ...@@ -51,7 +52,7 @@ describe('WindowList', () => {
expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1); expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1);
expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz'); expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz');
expect( expect(
wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem>untitled</MenuItem>), wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem><Typography>untitled</Typography></MenuItem>),
).toBe(true); ).toBe(true);
wrapper.find('WithStyles(MenuItem)').simulate('click', {}); wrapper.find('WithStyles(MenuItem)').simulate('click', {});
expect(handleClose).toBeCalled(); expect(handleClose).toBeCalled();
...@@ -80,7 +81,7 @@ describe('WindowList', () => { ...@@ -80,7 +81,7 @@ describe('WindowList', () => {
expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1); expect(wrapper.find('WithStyles(MenuItem)').length).toBe(1);
expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz'); expect(wrapper.find('WithStyles(MenuItem)').key()).toBe('xyz');
expect( expect(
wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem>Some title</MenuItem>), wrapper.find('WithStyles(MenuItem)').matchesElement(<MenuItem><Typography>Some title</Typography></MenuItem>),
).toBe(true); ).toBe(true);
}); });
}); });
......
...@@ -21,7 +21,6 @@ export class WindowSideBarInfoPanel extends Component { ...@@ -21,7 +21,6 @@ export class WindowSideBarInfoPanel extends Component {
canvasDescription, canvasDescription,
canvasLabel, canvasLabel,
canvasMetadata, canvasMetadata,
classes,
manifestDescription, manifestDescription,
manifestLabel, manifestLabel,
manifestMetadata, manifestMetadata,
...@@ -35,14 +34,14 @@ export class WindowSideBarInfoPanel extends Component { ...@@ -35,14 +34,14 @@ export class WindowSideBarInfoPanel extends Component {
{canvasLabel && ( {canvasLabel && (
<> <>
<Typography variant="overline" id={`${id}-currentItem`}>{t('currentItem')}</Typography> <Typography variant="overline" id={`${id}-currentItem`}>{t('currentItem')}</Typography>
<Typography aria-labelledby={`${id}-currentItem`} variant="h4" className={classes.windowSideBarHeading}> <Typography aria-labelledby={`${id}-currentItem`} variant="h4">
{canvasLabel} {canvasLabel}
</Typography> </Typography>
</> </>
)} )}
{canvasDescription && ( {canvasDescription && (
<Typography variant="body2"> <Typography variant="body1">
<SanitizedHtml htmlString={canvasDescription} ruleSet="iiif" /> <SanitizedHtml htmlString={canvasDescription} ruleSet="iiif" />
</Typography> </Typography>
)} )}
...@@ -55,8 +54,8 @@ export class WindowSideBarInfoPanel extends Component { ...@@ -55,8 +54,8 @@ export class WindowSideBarInfoPanel extends Component {
{manifestLabel && ( {manifestLabel && (
<> <>
<Typography variant="overline" id={`${id}-resource`} component="p" className={classes.sectionHeading}>{t('resource')}</Typography> <Typography variant="overline" id={`${id}-resource`} component="p">{t('resource')}</Typography>
<Typography aria-labelledby={`${id}-resource`} variant="h4" className={classes.windowSideBarHeading}> <Typography aria-labelledby={`${id}-resource`} variant="h4">
{manifestLabel} {manifestLabel}
</Typography> </Typography>
</> </>
...@@ -81,7 +80,6 @@ WindowSideBarInfoPanel.propTypes = { ...@@ -81,7 +80,6 @@ WindowSideBarInfoPanel.propTypes = {
canvasDescription: PropTypes.string, canvasDescription: PropTypes.string,
canvasLabel: PropTypes.string, canvasLabel: PropTypes.string,
canvasMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types canvasMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types
classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
manifestLabel: PropTypes.string, manifestLabel: PropTypes.string,
manifestDescription: PropTypes.string, manifestDescription: PropTypes.string,
manifestMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types manifestMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types
...@@ -94,7 +92,6 @@ WindowSideBarInfoPanel.defaultProps = { ...@@ -94,7 +92,6 @@ WindowSideBarInfoPanel.defaultProps = {
canvasDescription: null, canvasDescription: null,
canvasLabel: null, canvasLabel: null,
canvasMetadata: [], canvasMetadata: [],
classes: {},
manifestLabel: null, manifestLabel: null,
manifestDescription: null, manifestDescription: null,
manifestMetadata: [], manifestMetadata: [],
......
import { compose } from 'redux'; import { compose } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core';
import miradorWithPlugins from '../lib/miradorWithPlugins'; import miradorWithPlugins from '../lib/miradorWithPlugins';
import { import {
getDestructuredMetadata, getDestructuredMetadata,
...@@ -31,18 +30,8 @@ const mapStateToProps = (state, { windowId }) => ({ ...@@ -31,18 +30,8 @@ const mapStateToProps = (state, { windowId }) => ({
manifestMetadata: getDestructuredMetadata(getWindowManifest(state, windowId).manifestation), manifestMetadata: getDestructuredMetadata(getWindowManifest(state, windowId).manifestation),
}); });
/**
*
* @param theme
* @returns {{windowSideBarHeading: *}}
*/
const styles = theme => ({
windowSideBarHeading: theme.typography.h6,
});
const enhance = compose( const enhance = compose(
withTranslation(), withTranslation(),
withStyles(styles),
connect(mapStateToProps, null), connect(mapStateToProps, null),
miradorWithPlugins, miradorWithPlugins,
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment