Skip to content

Commit

Permalink
Moving array descriptions outside of Description.
Browse files Browse the repository at this point in the history
  • Loading branch information
erinesullivan committed Nov 22, 2024
1 parent 3181a58 commit ff3f1cb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
20 changes: 1 addition & 19 deletions src/modules/metadata/components/Description/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ import React from 'react';
import { TrimString } from '../../../core';

const Description = ({ data, viewType }) => {
if (Array.isArray(data)) {
return (
<ol className='list__unstyled'>
{data.map((datum, index) => {
return (
<li key={index}>
{index > 0 && <Icon icon='navigate_next' className='text-grey__light' />}
<Description data={datum} />
</li>
);
})}
</ol>
);
}

const { icon, image, search: { scope } = {}, text } = data;

return (
Expand All @@ -34,10 +19,7 @@ const Description = ({ data, viewType }) => {
};

Description.propTypes = {
data: PropTypes.oneOfType([
PropTypes.array,
PropTypes.object
]),
data: PropTypes.object,
viewType: PropTypes.string
};

Expand Down
Empty file.
18 changes: 16 additions & 2 deletions src/modules/metadata/components/Metadata/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
ContextProvider,
Expandable,
ExpandableButton,
ExpandableChildren
ExpandableChildren,
Icon
} from '../../../reusable';
import Description from '../Description';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -39,7 +40,20 @@ const Metadata = ({ metadata = {} }) => {
{description.map((descriptor, index) => {
return (
<dd key={index}>
<Description data={descriptor} viewType={viewType} />
{Array.isArray(descriptor)
? (
<ol className='list__unstyled'>
{descriptor.map((descript, number) => {
return (
<li key={number}>
{number > 0 && <Icon icon='navigate_next' className='text-grey__light' />}
<Description data={descript} />
</li>
);
})}
</ol>
)
: <Description data={descriptor} viewType={viewType} />}
</dd>
);
})}
Expand Down

0 comments on commit ff3f1cb

Please sign in to comment.