Skip to content

Commit

Permalink
don't pluralize video count label when track only has one video
Browse files Browse the repository at this point in the history
  • Loading branch information
fturmel committed Oct 1, 2023
1 parent 9a5ad06 commit 11d5bbc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/tracks/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ const FilteredVideosSection = ({ videos: allVideos, trackSlug }) => {
const [expanded, setExpanded] = useState(false);
const canExpand = allVideos.length > 6;
const videos = expanded || !canExpand ? allVideos : allVideos.slice(0, 6);

return (
<section>
<div className={css.filterHeading}>
{allVideos.length} videos within this track match the filter.
{allVideos.length} video{allVideos.length > 1 ? 's' : ''} within this
track match the filter.
</div>
<div className={css.filteredResults}>
{videos.map((v, i) => (
Expand Down Expand Up @@ -113,7 +115,9 @@ const Card = ({
<h3 className={css.smallTitle}>{title}</h3>
<div className={css.icon}>👁</div>
<div className={css.trackType}>{trackType}</div>
<div className={css.numVideos}>{numVideos} videos</div>
<div className={css.numVideos}>
{numVideos} video{numVideos > 1 ? 's' : ''}
</div>
</div>
<Image
image={image}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tracks/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Header = ({ track }) => {
}`
]
: []),
`${numVideos} videos`
`${numVideos} video${numVideos > 1 ? 's' : ''}`
]}
singleLine={false}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const TrackCard = ({ track, placeholderImage }) => {
<Link to={`tracks/${slug}`}>{title}</Link>
</h3>

<div className={css.numVideos}>{numVideos} videos</div>
<div className={css.numVideos}>
{numVideos} video{numVideos > 1 ? 's' : ''}
</div>
</div>
<Link to={`tracks/${slug}`}>
<Image
Expand Down

0 comments on commit 11d5bbc

Please sign in to comment.