-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a31e64b
commit 5b2dc44
Showing
4 changed files
with
53 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,20 @@ | ||
import { Avatar, AvatarGroup, Typography } from '@mui/material' | ||
import css from '../styles.module.css' | ||
import { Avatar, AvatarGroup } from '@mui/material' | ||
import type { Entry } from 'contentful' | ||
import type { TypeAuthorSkeleton } from '@/contentful/types' | ||
import { isAsset } from '@/lib/typeGuards' | ||
import { formatAuthorsList } from '@/components/Blog/utils/formatAuthorsList' | ||
|
||
export type AuthorsProps = Entry<TypeAuthorSkeleton, undefined, string>[] | ||
|
||
const Authors = ({ authors }: { authors: AuthorsProps }) => { | ||
return ( | ||
<div className={css.authors}> | ||
<AvatarGroup className={css.avatarGroup} max={3}> | ||
{authors.map((author) => { | ||
const { name, picture } = author.fields | ||
const Authors = ({ authors }: { authors: AuthorsProps }) => ( | ||
<AvatarGroup max={3}> | ||
{authors.map((author) => { | ||
const { name, picture } = author.fields | ||
|
||
return isAsset(picture) && picture.fields.file?.url ? ( | ||
<Avatar key={name} src={picture.fields.file.url} alt={picture.fields.title} /> | ||
) : undefined | ||
})} | ||
</AvatarGroup> | ||
|
||
<Typography variant="caption" color="text.primary"> | ||
{formatAuthorsList(authors)} | ||
</Typography> | ||
</div> | ||
) | ||
} | ||
return isAsset(picture) && picture.fields.file?.url ? ( | ||
<Avatar key={name} src={picture.fields.file.url} alt={picture.fields.title} /> | ||
) : undefined | ||
})} | ||
</AvatarGroup> | ||
) | ||
|
||
export default Authors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters