Skip to content
Snippets Groups Projects
Unverified Commit ebc3ce0f authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #2169 from ProjectMirador/2138-typography-adjustments

Implement typography adjustments
parents b7411191 3c13e892
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 41 deletions
...@@ -28,7 +28,7 @@ describe('Annotations in Mirador', () => { ...@@ -28,7 +28,7 @@ describe('Annotations in Mirador', () => {
await expect(page).toClick(`#${windowId} button[aria-label="Open annotation companion window"]`); await expect(page).toClick(`#${windowId} button[aria-label="Open annotation companion window"]`);
await expect(page).toMatchElement(`#${windowId} h3`, { text: 'Annotations' }); await expect(page).toMatchElement(`#${windowId} h3`, { text: 'Annotations' });
await expect(page).toMatchElement(`#${windowId} p`, { text: 'Showing 2 annotations' }); await expect(page).toMatchElement(`#${windowId} h6`, { text: 'Showing 2 annotations' });
await expect(page).toMatchElement(`#${windowId} .mirador-companion-window-left.mirador-window-sidebar-annotation-panel ul li`, { count: 2 }); await expect(page).toMatchElement(`#${windowId} .mirador-companion-window-left.mirador-window-sidebar-annotation-panel ul li`, { count: 2 });
}); });
}); });
...@@ -23,7 +23,7 @@ describe('CompanionWindowFactory', () => { ...@@ -23,7 +23,7 @@ describe('CompanionWindowFactory', () => {
content: 'info', content: 'info',
}); });
expect(wrapper.find('WithStyles(Connect(WindowSideBarInfoPanel))').length).toBe(1); expect(wrapper.find('Connect(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);
}); });
}); });
......
...@@ -33,7 +33,7 @@ export class LanguageSettings extends Component { ...@@ -33,7 +33,7 @@ export class LanguageSettings extends Component {
&& <ListItemIcon><CheckIcon /></ListItemIcon> && <ListItemIcon><CheckIcon /></ListItemIcon>
} }
<ListItemText inset> <ListItemText inset>
<Typography variant="inherit"> <Typography variant="body1">
{language.label} {language.label}
</Typography> </Typography>
</ListItemText> </ListItemText>
......
...@@ -66,7 +66,7 @@ export class ManifestForm extends Component { ...@@ -66,7 +66,7 @@ export class ManifestForm extends Component {
*/ */
render() { render() {
const { formValue } = this.state; const { formValue } = this.state;
const { t, onCancel } = this.props; const { classes, t, onCancel } = this.props;
return ( return (
<form onSubmit={this.formSubmit}> <form onSubmit={this.formSubmit}>
<Grid container spacing={24}> <Grid container spacing={24}>
...@@ -80,6 +80,12 @@ export class ManifestForm extends Component { ...@@ -80,6 +80,12 @@ export class ManifestForm extends Component {
variant="filled" variant="filled"
label={t('addManifestUrl')} label={t('addManifestUrl')}
helperText={t('addManifestUrlHelp')} helperText={t('addManifestUrlHelp')}
InputLabelProps={{
shrink: true,
}}
InputProps={{
className: classes.input,
}}
/> />
</Grid> </Grid>
<Grid item sm={3}> <Grid item sm={3}>
...@@ -99,6 +105,7 @@ export class ManifestForm extends Component { ...@@ -99,6 +105,7 @@ export class ManifestForm extends Component {
} }
ManifestForm.propTypes = { ManifestForm.propTypes = {
classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
fetchManifest: PropTypes.func.isRequired, fetchManifest: PropTypes.func.isRequired,
onCancel: PropTypes.func, onCancel: PropTypes.func,
onSubmit: PropTypes.func, onSubmit: PropTypes.func,
...@@ -106,6 +113,7 @@ ManifestForm.propTypes = { ...@@ -106,6 +113,7 @@ ManifestForm.propTypes = {
}; };
ManifestForm.defaultProps = { ManifestForm.defaultProps = {
classes: {},
t: key => key, t: key => key,
onCancel: null, onCancel: null,
onSubmit: () => {}, onSubmit: () => {},
......
...@@ -106,7 +106,7 @@ export class ManifestListItem extends React.Component { ...@@ -106,7 +106,7 @@ export class ManifestListItem extends React.Component {
} }
</Grid> </Grid>
<Grid item xs={8} sm={9}> <Grid item xs={8} sm={9}>
<Typography component="span" variant="subtitle1" color="secondary"> <Typography component="span" variant="h6">
{title || manifestId} {title || manifestId}
</Typography> </Typography>
</Grid> </Grid>
......
...@@ -52,7 +52,7 @@ export class NestedMenu extends Component { ...@@ -52,7 +52,7 @@ export class NestedMenu extends Component {
&& (<ListItemIcon>{icon}</ListItemIcon>) && (<ListItemIcon>{icon}</ListItemIcon>)
} }
<ListItemText> <ListItemText>
<Typography varient="inherit">{label}</Typography> <Typography varient="body1">{label}</Typography>
</ListItemText> </ListItemText>
{ {
nestedMenuIsOpen nestedMenuIsOpen
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import Menu from '@material-ui/core/Menu'; import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem'; import MenuItem from '@material-ui/core/MenuItem';
import Typography from '@material-ui/core/Typography';
import ListSubheader from '@material-ui/core/ListSubheader'; import ListSubheader from '@material-ui/core/ListSubheader';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ns from '../config/css-ns'; import ns from '../config/css-ns';
...@@ -49,9 +50,11 @@ export class WindowList extends Component { ...@@ -49,9 +50,11 @@ export class WindowList extends Component {
selected={i === 0} selected={i === 0}
onClick={(e) => { focusWindow(window.id); handleClose(e); }} onClick={(e) => { focusWindow(window.id); handleClose(e); }}
> >
<Typography variant="body1">
{ {
this.titleContent(window) this.titleContent(window)
} }
</Typography>
</MenuItem> </MenuItem>
)) ))
} }
......
...@@ -41,7 +41,7 @@ export class WindowSideBarAnnotationsPanel extends Component { ...@@ -41,7 +41,7 @@ export class WindowSideBarAnnotationsPanel extends Component {
} = this.props; } = this.props;
return ( return (
<CompanionWindow title={t('annotations')} paperClassName={ns('window-sidebar-annotation-panel')} windowId={windowId} id={id}> <CompanionWindow title={t('annotations')} paperClassName={ns('window-sidebar-annotation-panel')} windowId={windowId} id={id}>
<Typography variant="body2">{t('showingNumAnnotations', { number: annotations.length })}</Typography> <Typography variant="subtitle2">{t('showingNumAnnotations', { number: annotations.length })}</Typography>
{this.sanitizedAnnotations()} {this.sanitizedAnnotations()}
</CompanionWindow> </CompanionWindow>
); );
......
...@@ -40,7 +40,7 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -40,7 +40,7 @@ export class WindowSideBarCanvasPanel extends Component {
<> <>
<Typography <Typography
className={classNames(classes.label)} className={classNames(classes.label)}
variant="body2" variant="body1"
> >
{canvas.label} {canvas.label}
</Typography> </Typography>
...@@ -70,7 +70,7 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -70,7 +70,7 @@ export class WindowSideBarCanvasPanel extends Component {
</div> </div>
<Typography <Typography
className={classNames(classes.label)} className={classNames(classes.label)}
variant="body2" variant="body1"
> >
{canvas.label} {canvas.label}
</Typography> </Typography>
...@@ -101,12 +101,11 @@ export class WindowSideBarCanvasPanel extends Component { ...@@ -101,12 +101,11 @@ export class WindowSideBarCanvasPanel extends Component {
value={variant} value={variant}
onChange={this.handleVariantChange} onChange={this.handleVariantChange}
name="variant" name="variant"
autoWidth
variant="filled" variant="filled"
input={<FilledInput name="variant" />} input={<FilledInput name="variant" />}
> >
<MenuItem value="compact">{ t('compactList') }</MenuItem> <MenuItem value="compact"><Typography variant="body2">{ t('compactList') }</Typography></MenuItem>
<MenuItem value="thumbnail">{ t('thumbnailList') }</MenuItem> <MenuItem value="thumbnail"><Typography variant="body2">{ t('thumbnailList') }</Typography></MenuItem>
</Select> </Select>
</FormControl> </FormControl>
)} )}
......
...@@ -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: [],
......
...@@ -111,14 +111,14 @@ export class WorkspaceMenu extends Component { ...@@ -111,14 +111,14 @@ export class WorkspaceMenu extends Component {
onClick={(e) => { this.handleMenuItemClick('windowList', e); handleClose(e); }} onClick={(e) => { this.handleMenuItemClick('windowList', e); handleClose(e); }}
aria-owns={windowList.anchorEl ? 'window-list-menu' : undefined} aria-owns={windowList.anchorEl ? 'window-list-menu' : undefined}
> >
<Typography varient="inherit">{t('listAllOpenWindows')}</Typography> <Typography variant="body1">{t('listAllOpenWindows')}</Typography>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
aria-haspopup="true" aria-haspopup="true"
onClick={(e) => { this.handleZoomToggleClick(e); handleClose(e); }} onClick={(e) => { this.handleZoomToggleClick(e); handleClose(e); }}
aria-owns={toggleZoom.anchorEl ? 'toggle-zoom-menu' : undefined} aria-owns={toggleZoom.anchorEl ? 'toggle-zoom-menu' : undefined}
> >
<Typography varient="inherit"> <Typography variant="body1">
{ showZoomControls ? t('hideZoomControls') : t('showZoomControls') } { showZoomControls ? t('hideZoomControls') : t('showZoomControls') }
</Typography> </Typography>
</MenuItem> </MenuItem>
...@@ -127,7 +127,7 @@ export class WorkspaceMenu extends Component { ...@@ -127,7 +127,7 @@ export class WorkspaceMenu extends Component {
onClick={(e) => { this.handleMenuItemClick('workspaceSelection', e); handleClose(e); }} onClick={(e) => { this.handleMenuItemClick('workspaceSelection', e); handleClose(e); }}
aria-owns={workspaceSelection.anchorEl ? 'workspace-selection' : undefined} aria-owns={workspaceSelection.anchorEl ? 'workspace-selection' : undefined}
> >
<Typography varient="inherit">{t('selectWorkspaceMenu')}</Typography> <Typography variant="body1">{t('selectWorkspaceMenu')}</Typography>
</MenuItem> </MenuItem>
<NestedMenu label={t('language')} divider> <NestedMenu label={t('language')} divider>
...@@ -142,7 +142,7 @@ export class WorkspaceMenu extends Component { ...@@ -142,7 +142,7 @@ export class WorkspaceMenu extends Component {
<ListItemIcon> <ListItemIcon>
<SettingsIcon /> <SettingsIcon />
</ListItemIcon> </ListItemIcon>
<Typography varient="inherit">{t('settings')}</Typography> <Typography variant="body1">{t('settings')}</Typography>
</MenuItem> </MenuItem>
<MenuItem <MenuItem
aria-haspopup="true" aria-haspopup="true"
...@@ -152,7 +152,7 @@ export class WorkspaceMenu extends Component { ...@@ -152,7 +152,7 @@ export class WorkspaceMenu extends Component {
<ListItemIcon> <ListItemIcon>
<SaveAltIcon /> <SaveAltIcon />
</ListItemIcon> </ListItemIcon>
<Typography varient="inherit">{t('downloadExportWorkspace')}</Typography> <Typography variant="body1">{t('downloadExportWorkspace')}</Typography>
</MenuItem> </MenuItem>
</Menu> </Menu>
<WindowList <WindowList
......
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { compose } from 'redux'; import { compose } from 'redux';
import { withTranslation } from 'react-i18next'; import { withTranslation } from 'react-i18next';
import { withStyles } from '@material-ui/core';
import * as actions from '../state/actions'; import * as actions from '../state/actions';
import { ManifestForm } from '../components/ManifestForm'; import { ManifestForm } from '../components/ManifestForm';
...@@ -10,8 +11,18 @@ import { ManifestForm } from '../components/ManifestForm'; ...@@ -10,8 +11,18 @@ import { ManifestForm } from '../components/ManifestForm';
* @private * @private
*/ */
const mapDispatchToProps = { fetchManifest: actions.fetchManifest }; const mapDispatchToProps = { fetchManifest: actions.fetchManifest };
/**
*
* @param theme
*/
const styles = theme => ({
input: {
...theme.typography.body1,
},
});
const enhance = compose( const enhance = compose(
withStyles(styles),
withTranslation(), withTranslation(),
connect(null, mapDispatchToProps), connect(null, mapDispatchToProps),
); );
......
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 { import {
getDestructuredMetadata, getDestructuredMetadata,
getCanvasLabel, getCanvasLabel,
...@@ -30,18 +29,8 @@ const mapStateToProps = (state, { windowId }) => ({ ...@@ -30,18 +29,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),
); );
......
...@@ -44,7 +44,6 @@ const styles = theme => ({ ...@@ -44,7 +44,6 @@ const styles = theme => ({
}, },
typographyBody: { typographyBody: {
flexGrow: 1, flexGrow: 1,
fontSize: '1em',
}, },
menuButton: { menuButton: {
marginLeft: -12, marginLeft: -12,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment