Skip to content

Commit

Permalink
feat: create avatar image in byline
Browse files Browse the repository at this point in the history
  • Loading branch information
martinezpoa committed Jan 15, 2024
1 parent abaf275 commit 2d97fe9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
36 changes: 22 additions & 14 deletions components/Article/Byline/Byline.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const Byline = ({
amp,
author,
authors,
avatar,
content,
dateline,
datetime,
Expand All @@ -20,6 +21,8 @@ const Byline = ({
share
}) => {

const hasAvatar = get(avatar, 'enabled', false)
const AvatarComponent = get(avatar, 'component', false)
const shareData = get(share, 'byline', {})
const shareColor = get(share, 'color', undefined)
const shareSize = get(share, 'size', undefined)
Expand All @@ -31,20 +34,21 @@ const Byline = ({
if (!hasAuthorEmail && !hasAuthorSocialMedias) {
return null
}

return (
<Block mb={1}>
{hasAuthorSocialMedias && (
<S.BylineText {...datetime}>
{author.socialMedias}
</S.BylineText>
)}
{hasAuthorEmail && (
<S.BylineText {...datetime}>
{author.email}
</S.BylineText>
)}
</Block>
<>
<Block mb={1}>
{hasAuthorSocialMedias && (
<S.BylineText {...datetime}>
{author.socialMedias}
</S.BylineText>
)}
{hasAuthorEmail && (
<S.BylineText {...datetime}>
{author.email}
</S.BylineText>
)}
</Block>
</>
)
}

Expand Down Expand Up @@ -79,10 +83,14 @@ const Byline = ({
</Block>
)
}

return (
<S.Container>
<S.Content {...content}>
<S.ContentAvatar>
{hasAvatar && (
<AvatarComponent />
)}
</S.ContentAvatar>
<S.BylineContainer {...dateline}>
{authors.items.length > 0 ? (
<ManyAuthors items={authors.items} />
Expand Down
13 changes: 13 additions & 0 deletions components/Article/Byline/Byline.styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ Content.propTypes = {
mb: PropTypes.array
}

export const ContentAvatar = ({ children }) =>
<Block
mb='16px'
lg={{ mb: '0px', mr: '16px' }}
>
{children}
</Block>

ContentAvatar.propTypes = {
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
mb: PropTypes.array
}

export const BylineContainer = ({ children, mb }) =>
<Block
mb={mb[0]}
Expand Down
Binary file added icons/logo-publica.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2d97fe9

Please sign in to comment.