Skip to content
Snippets Groups Projects
Commit f75fa1ca authored by Jessie Keck's avatar Jessie Keck
Browse files

Wrap contents inside dt/dd with a Typography component.

This reverts commit acdb28ec.
parent 09ca9b6a
No related branches found
No related tags found
No related merge requests found
...@@ -31,8 +31,8 @@ describe('LabelValueMetadata', () => { ...@@ -31,8 +31,8 @@ describe('LabelValueMetadata', () => {
}); });
it('renders correct labels in dt', () => { it('renders correct labels in dt', () => {
expect(wrapper.find('dt').first().text()).toEqual('Label 1'); expect(wrapper.find('dt WithStyles(Typography)').first().children().text()).toEqual('Label 1');
expect(wrapper.find('dt').last().text()).toEqual('Label 2'); expect(wrapper.find('dt WithStyles(Typography)').last().children().text()).toEqual('Label 2');
}); });
it('renders SanitizedHtml component in dt for each value', () => { it('renders SanitizedHtml component in dt for each value', () => {
......
...@@ -52,17 +52,15 @@ describe('WindowSideBarInfoPanel', () => { ...@@ -52,17 +52,15 @@ describe('WindowSideBarInfoPanel', () => {
it('renders canvas metadata in LabelValueMetadata component', () => { it('renders canvas metadata in LabelValueMetadata component', () => {
expect( expect(
wrapper.find(Typography).at(3).matchesElement( wrapper.find(LabelValueMetadata).at(0).matchesElement(
<Typography> <LabelValueMetadata labelValuePairs={metadata} />,
<LabelValueMetadata labelValuePairs={metadata} />
</Typography>,
), ),
).toBe(true); ).toBe(true);
}); });
it('renders manifest label', () => { it('renders manifest label', () => {
expect( expect(
wrapper.find(Typography).at(4).matchesElement( wrapper.find(Typography).at(3).matchesElement(
<Typography>The Manifest Label</Typography>, <Typography>The Manifest Label</Typography>,
), ),
).toBe(true); ).toBe(true);
...@@ -70,7 +68,7 @@ describe('WindowSideBarInfoPanel', () => { ...@@ -70,7 +68,7 @@ describe('WindowSideBarInfoPanel', () => {
it('renders manifest description in SanitizedHtml component', () => { it('renders manifest description in SanitizedHtml component', () => {
expect( expect(
wrapper.find(Typography).at(5).matchesElement( wrapper.find(Typography).at(4).matchesElement(
<Typography> <Typography>
<SanitizedHtml htmlString="The Manifest Description" ruleSet="iiif" /> <SanitizedHtml htmlString="The Manifest Description" ruleSet="iiif" />
</Typography>, </Typography>,
...@@ -80,10 +78,8 @@ describe('WindowSideBarInfoPanel', () => { ...@@ -80,10 +78,8 @@ describe('WindowSideBarInfoPanel', () => {
it('renders manifest metadata in LabelValueMetadata component', () => { it('renders manifest metadata in LabelValueMetadata component', () => {
expect( expect(
wrapper.find(Typography).at(6).matchesElement( wrapper.find(LabelValueMetadata).at(1).matchesElement(
<Typography> <LabelValueMetadata labelValuePairs={metadata} />,
<LabelValueMetadata labelValuePairs={metadata} />
</Typography>,
), ),
).toBe(true); ).toBe(true);
}); });
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import Typography from '@material-ui/core/Typography';
import { SanitizedHtml } from './SanitizedHtml'; import { SanitizedHtml } from './SanitizedHtml';
/** /**
...@@ -26,10 +27,12 @@ export class LabelValueMetadata extends Component { ...@@ -26,10 +27,12 @@ export class LabelValueMetadata extends Component {
<dl> <dl>
{labelValuePairs.reduce((acc, labelValuePair, i) => acc.concat([ {labelValuePairs.reduce((acc, labelValuePair, i) => acc.concat([
<dt key={`label-${i}`}> <dt key={`label-${i}`}>
{labelValuePair.label} <Typography variant="body2">{labelValuePair.label}</Typography>
</dt>, </dt>,
<dd key={`value-${i}`}> <dd key={`value-${i}`}>
<Typography variant="body2">
<SanitizedHtml htmlString={labelValuePair.value} ruleSet="iiif" /> <SanitizedHtml htmlString={labelValuePair.value} ruleSet="iiif" />
</Typography>
</dd>, </dd>,
]), [])} ]), [])}
</dl> </dl>
......
...@@ -47,9 +47,7 @@ export class WindowSideBarInfoPanel extends Component { ...@@ -47,9 +47,7 @@ export class WindowSideBarInfoPanel extends Component {
)} )}
{canvasMetadata.length > 0 && ( {canvasMetadata.length > 0 && (
<Typography variant="body2">
<LabelValueMetadata labelValuePairs={canvasMetadata} /> <LabelValueMetadata labelValuePairs={canvasMetadata} />
</Typography>
)} )}
<Divider /> <Divider />
...@@ -67,9 +65,7 @@ export class WindowSideBarInfoPanel extends Component { ...@@ -67,9 +65,7 @@ export class WindowSideBarInfoPanel extends Component {
)} )}
{manifestMetadata.length > 0 && ( {manifestMetadata.length > 0 && (
<Typography variant="body2">
<LabelValueMetadata labelValuePairs={manifestMetadata} /> <LabelValueMetadata labelValuePairs={manifestMetadata} />
</Typography>
)} )}
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment