Merge pull request #397 from MuhammadWasif/label-fix

Display author name when only one contributor
This commit is contained in:
Jean-Philippe Sirois
2021-05-27 02:54:04 -04:00
committed by GitHub
+12 -8
View File
@@ -45,14 +45,18 @@ export const Header: React.FC<IHeaderProps> = ({
{authors && ( {authors && (
<SC.Meta> <SC.Meta>
<StackedAvatars authors={authors} /> <StackedAvatars authors={authors} />
<SC.PopoverToggler> {authors.length > 1 ? (
{authors.length} contributor{authors.length > 1 && "s"} <SC.PopoverToggler>
<SC.Popover> {authors.length} contributor{authors.length > 1 && "s"}
{authors <SC.Popover>
.map((author) => `${author.name}#${author.hash}`) {authors
.join(", ")} .map((author) => `${author.name}#${author.hash}`)
</SC.Popover> .join(", ")}
</SC.PopoverToggler> </SC.Popover>
</SC.PopoverToggler>
) : (
`${authors[0].name}#${authors[0].hash}`
)}
</SC.Meta> </SC.Meta>
)} )}
{dateToHuman && <SC.Meta>{dateToHuman}</SC.Meta>} {dateToHuman && <SC.Meta>{dateToHuman}</SC.Meta>}