Repository navigation
Expand file tree
/
Copy pathPublications.tsx
More file actions
133 lines (125 loc) · 3.24 KB
/
Copy pathPublications.tsx
File metadata and controls
133 lines (125 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
'use client';
import LinkIcon from '@components/link-icon/LinkIcon';
import { logAnalyticsEvent } from '@configs/firebase';
import publications from '@data/publications';
import { Box, Stack, Typography } from '@mui/material';
import { colors, focusRing } from '@styles/tokens';
import Link from 'next/link';
/** Renders a list of featured publications with their details. */
export default function Publications() {
const metaStyling = {
fontSize: 'clamp(0.5rem, 0.75rem, 0.75rem)',
};
return (
publications && (
<Stack
aria-label='Publications'
className='publications'
direction='column'
id='publications'
spacing={2}
sx={{
margin: 'auto',
maxWidth: {
xs: '95%',
sm: '80%',
md: 'min(1080px, 80%)',
},
marginTop: '3rem',
marginBottom: '2rem',
zIndex: 1,
}}
>
<Typography
sx={{
fontSize: 'clamp(1.5rem, 2.5vw, 2.5rem)',
textAlign: 'center',
}}
variant='h2'
>
Featured Publications
</Typography>
{publications.map((publication) => {
const href = `https://doi.org/${publication.doi}`;
const logClick = () => {
logAnalyticsEvent(`publication-${publication.doi}`, {
name: `publication-${publication.doi}`,
type: 'click',
});
};
return (
<Stack
key={publication.doi}
component='article'
direction='column'
spacing={2}
sx={{
backgroundColor: '#1e2227',
borderRadius: '1rem',
padding: '1rem',
position: 'relative',
}}
>
{/*
* The title link stretches over the whole card, so clicking anywhere opens the paper. Links
* cannot nest, so the card is not itself a link, and the DOI link sits above the stretched one.
*/}
<Typography
component='h2'
sx={{
'& a::after': {
borderRadius: '1rem',
content: '""',
inset: 0,
position: 'absolute',
},
'& a:focus-visible': { outline: 'none' },
'& a:focus-visible::after': focusRing,
}}
variant='h5'
>
<Link
aria-label={`View ${publication.title} on ${publication.journal}`}
href={href}
onClick={logClick}
prefetch
rel='noopener noreferrer'
style={{
textDecoration: 'none',
color: 'inherit',
}}
target='_blank'
>
{publication.title}
</Link>
</Typography>
<Typography style={metaStyling}>{publication.authors.join(', ')}</Typography>
<Typography style={metaStyling}>
<Box
component='a'
href={href}
onClick={logClick}
rel='noopener noreferrer'
sx={{
color: colors.link,
position: 'relative',
zIndex: 1,
'&:focus-visible': focusRing,
}}
target='_blank'
>
<LinkIcon href={href} />
{publication.doi}
</Box>
{` | ${publication.journal} | ${publication.date}`}
</Typography>
<Typography component='p' variant='body1'>
{`${publication.abstract.substring(0, 550)}...`}
</Typography>
</Stack>
);
})}
</Stack>
)
);
}