Skip to content

Commit 025c6a4

Browse files
authored
Merge pull request #24 from wickathou/update/multiple-updates
Added styleModifier function to ProjectGridItem to render projects appropriately
2 parents cb2f849 + 1216771 commit 025c6a4

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

  • frontend/src/components/projects/ProjectsGridItem

frontend/src/components/projects/ProjectsGridItem/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,24 @@ const ProjectsGridItem = ({
118118
}
119119
}
120120

121+
const styling = {
122+
punchlineMaxLength: 150,
123+
}
124+
125+
const stylingModifiers = styleRules => {
126+
if (showTableLocation) {
127+
styleRules.punchlineMaxLength = styleRules.punchlineMaxLength - 25
128+
}
129+
if (showScore) {
130+
styleRules.punchlineMaxLength = styleRules.punchlineMaxLength - 25
131+
}
132+
if (showReviewers) {
133+
styleRules.punchlineMaxLength = styleRules.punchlineMaxLength - 50
134+
}
135+
}
136+
137+
stylingModifiers(styling)
138+
121139
return (
122140
<Grid item xs={12} sm={6} md={4} style={{ display: 'flex' }}>
123141
<Card
@@ -167,8 +185,9 @@ const ProjectsGridItem = ({
167185
</div>
168186
{project?.punchline && (
169187
<Typography variant="body1" component="p">
188+
{showTableLocation && showScore}
170189
{_.truncate(project.punchline, {
171-
length: 150,
190+
length: styling.punchlineMaxLength,
172191
})}
173192
</Typography>
174193
)}

0 commit comments

Comments
 (0)