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') { ...@@ -195,7 +195,7 @@ if (process.env.NODE_ENV === 'development') {
defaultFormValues = { defaultFormValues = {
acknowledgements: '', acknowledgements: '',
author: { author: {
affiliations: 'University of Chicago', affiliations: 'University of Chicago.',
credit: ['software'], credit: ['software'],
email: 'john@john.com', email: 'john@john.com',
name: 'John A Bryden', name: 'John A Bryden',
...@@ -210,7 +210,7 @@ if (process.env.NODE_ENV === 'development') { ...@@ -210,7 +210,7 @@ if (process.env.NODE_ENV === 'development') {
WBId: 'WBPerson18694', WBId: 'WBPerson18694',
}, },
{ {
affiliations: 'University of Virginia', affiliations: 'University of Chicago',
credit: ['dataCuration'], credit: ['dataCuration'],
id: uuid(), id: uuid(),
name: 'Alec Barret', name: 'Alec Barret',
......
...@@ -31,11 +31,16 @@ const isHTMLNotEmpty = html => stripHTML(html).length > 0 ...@@ -31,11 +31,16 @@ const isHTMLNotEmpty = html => stripHTML(html).length > 0
const mapAuthorsToValues = (authors, field) => { const mapAuthorsToValues = (authors, field) => {
if (!authors) return null 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 deduped = uniq(fields)
const displayValues = deduped.map((f, i) => { const displayValues = deduped.map((f, i) => {
if (affiliations) return f
if (i === deduped.length - 1) return f if (i === deduped.length - 1) return f
if (i === deduped.length - 2) return `${f} and ` if (i === deduped.length - 2) return `${f} and `
return `${f}, ` return `${f}, `
...@@ -110,9 +115,10 @@ const Section = styled.section` ...@@ -110,9 +115,10 @@ const Section = styled.section`
text-align: justify; text-align: justify;
` `
const Lab = styled.div` const Affiliations = styled.div`
font-size: ${th('fontSizeBaseSmall')}; font-size: ${th('fontSizeBaseSmall')};
line-height: ${th('lineHeightBaseSmall')}; line-height: ${th('lineHeightBaseSmall')};
margin-top: ${th('gridUnit')};
` `
const Image = styled.img` const Image = styled.img`
...@@ -282,7 +288,11 @@ const Preview = props => { ...@@ -282,7 +288,11 @@ const Preview = props => {
<Section> <Section>
<Title>{title}</Title> <Title>{title}</Title>
<div>{authorNames}</div> <div>{authorNames}</div>
<Lab>{affiliations}</Lab> <Affiliations>
{affiliations.map(item => (
<div>{item}</div>
))}
</Affiliations>
</Section> </Section>
{image && {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