Commit 64e00343 authored by Yannis Barlas's avatar Yannis Barlas

feat(preview): list affiliations on separate lines

parent ceed9e6e
......@@ -195,7 +195,7 @@ if (process.env.NODE_ENV === 'development') {
defaultFormValues = {
acknowledgements: '',
author: {
affiliations: 'University of Chicago',
affiliations: 'University of Chicago.',
credit: ['software'],
email: 'john@john.com',
name: 'John A Bryden',
......@@ -210,7 +210,7 @@ if (process.env.NODE_ENV === 'development') {
WBId: 'WBPerson18694',
},
{
affiliations: 'University of Virginia',
affiliations: 'University of Chicago',
credit: ['dataCuration'],
id: uuid(),
name: 'Alec Barret',
......
......@@ -31,11 +31,16 @@ const isHTMLNotEmpty = html => stripHTML(html).length > 0
const mapAuthorsToValues = (authors, field) => {
if (!authors) return null
const affiliations = field === 'affiliations'
const fields = authors.map(author => author[field].trim() || null)
// replace => remove . from end of string
const fields = authors.map(
author => author[field].trim().replace(/[.]$/, '') || null,
)
const deduped = uniq(fields)
const displayValues = deduped.map((f, i) => {
if (affiliations) return f
if (i === deduped.length - 1) return f
if (i === deduped.length - 2) return `${f} and `
return `${f}, `
......@@ -110,9 +115,10 @@ const Section = styled.section`
text-align: justify;
`
const Lab = styled.div`
const Affiliations = styled.div`
font-size: ${th('fontSizeBaseSmall')};
line-height: ${th('lineHeightBaseSmall')};
margin-top: ${th('gridUnit')};
`
const Image = styled.img`
......@@ -282,7 +288,11 @@ const Preview = props => {
<Section>
<Title>{title}</Title>
<div>{authorNames}</div>
<Lab>{affiliations}</Lab>
<Affiliations>
{affiliations.map(item => (
<div>{item}</div>
))}
</Affiliations>
</Section>
{image &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment