Skip to content

Commit

Permalink
Fix image line wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
iAdramelk committed Feb 4, 2020
1 parent 6515583 commit 57f367f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 40 deletions.
88 changes: 48 additions & 40 deletions src/Community/Learn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ import { pluralizeComments } from '../../utils/i18n'

import {
Comments,
ImageLine,
Item,
Items,
Line,
Link,
Meta,
NbspWrapper,
Placeholder,
TextWrapper,
Wrapper
} from '../styles'

Expand Down Expand Up @@ -56,7 +59,7 @@ function CommunityBlogPost({
}, [])

return (
<Line key={url}>
<ImageLine key={url}>
{pictureUrl && (
<a
href={url}
Expand All @@ -67,31 +70,33 @@ function CommunityBlogPost({
<Image src={pictureUrl} alt="" />
</a>
)}
<Link
color={color}
href={url}
target="_blank"
rel="noreferrer noopener"
onClick={logPost}
>
{title}
</Link>
<Meta>
{loaded && (
<>
<Comments
href={commentsUrl}
target="_blank"
rel="noreferrer noopener"
>
{pluralizeComments(count)}
</Comments>
{' • '}
</>
)}
{format(new Date(date), 'MMM, d')}
</Meta>
</Line>
<TextWrapper>
<Link
color={color}
href={url}
target="_blank"
rel="noreferrer noopener"
onClick={logPost}
>
{title}
</Link>
<Meta>
{loaded && (
<>
<Comments
href={commentsUrl}
target="_blank"
rel="noreferrer noopener"
>
{pluralizeComments(count)}
</Comments>
{' • '}
</>
)}
<NbspWrapper>{format(new Date(date), 'MMM, d')}</NbspWrapper>
</Meta>
</TextWrapper>
</ImageLine>
)
}

Expand All @@ -111,7 +116,7 @@ function CommunityUserContent({ url, title, author, date, color, pictureUrl }) {
)

return (
<Line key={url}>
<ImageLine key={url}>
{pictureUrl && (
<a
href={url}
Expand All @@ -122,19 +127,22 @@ function CommunityUserContent({ url, title, author, date, color, pictureUrl }) {
<Image src={pictureUrl} alt="" />
</a>
)}
<Link
color={color}
href={url}
target="_blank"
rel="noreferrer noopener"
onClick={logUserContent}
>
{title}
</Link>
<Meta>
{author}{format(new Date(date), 'MMM, d')}
</Meta>
</Line>
<TextWrapper>
<Link
color={color}
href={url}
target="_blank"
rel="noreferrer noopener"
onClick={logUserContent}
>
{title}
</Link>
<Meta>
{author}{' '}
<NbspWrapper>{format(new Date(date), 'MMM, d')}</NbspWrapper>
</Meta>
</TextWrapper>
</ImageLine>
)
}

Expand Down
9 changes: 9 additions & 0 deletions src/Community/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const Line = styled.div`
margin-top: 20px;
}
`
export const ImageLine = styled(Line)`
display: flex;
`

export const Link = styled.a`
font-size: ${({ large }) => (large ? '24px' : '16px')};
Expand Down Expand Up @@ -89,3 +92,9 @@ export const Wrapper = styled.div`
}
`}
`

export const TextWrapper = styled.div``

export const NbspWrapper = styled.span`
white-space: nowrap;
`

0 comments on commit 57f367f

Please sign in to comment.