Skip to content

Commit

Permalink
fix: show item descriptions
Browse files Browse the repository at this point in the history
closes #170
  • Loading branch information
juancarlosfarah committed Aug 15, 2019
1 parent 4781527 commit 31d6427
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/phase/PhaseItemDescription.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PhaseItemDescriptionText p {
font-size: small;
text-align: center;
}
36 changes: 36 additions & 0 deletions src/components/phase/PhaseItemDescription.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import PropTypes from 'prop-types';
import InfoIcon from '@material-ui/icons/Info';
import Text from '../common/Text';
import './PhaseItemDescription.css';

const style = {
marginTop: '1rem',
marginBottom: '1rem',
flexDirection: 'row',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
};

const PhaseItemDescription = ({ description }) => {
if (description && description !== '') {
return (
<div style={style}>
<InfoIcon color="primary" />
<Text content={description} className="PhaseItemDescriptionText" />
</div>
);
}
return null;
};

PhaseItemDescription.propTypes = {
description: PropTypes.string,
};

PhaseItemDescription.defaultProps = {
description: '',
};

export default PhaseItemDescription;
18 changes: 15 additions & 3 deletions src/components/phase/PhaseItems.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import React from 'react';
import PropTypes from 'prop-types';
import PhaseItem from './PhaseItem';
import PhaseItemDescription from './PhaseItemDescription';

const PhaseItems = ({ items, phaseId, spaceId }) => {
if (!items) {
return null;
}
return items.map(item => (
<PhaseItem key={item.id} phaseId={phaseId} spaceId={spaceId} item={item} />
));
return items.map(item => {
const { description } = item;
return (
<>
<PhaseItemDescription description={description} />
<PhaseItem
key={item.id}
phaseId={phaseId}
spaceId={spaceId}
item={item}
/>
</>
);
});
};

PhaseItems.propTypes = {
Expand Down

0 comments on commit 31d6427

Please sign in to comment.