-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HTD-53): add single post hero component (#77)
* feat(HTD-53): add single post hero component - replace header images path * feat(HTD-53): rwd adjustments * feat(HTD-53): enable blur images
- Loading branch information
Showing
72 changed files
with
278 additions
and
103 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
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 was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { | ||
StyledGoBack, | ||
StyledPostMeta, | ||
StyledSinglePost, | ||
StyledSinglePostDetails, | ||
StyledSinglePostImageWrapper, | ||
StyledTags, | ||
} from './single-post-hero.styles'; | ||
|
||
import { Badge } from '@/components/elements/badge'; | ||
import { Heading } from '@/components/elements/heading'; | ||
import { CaretLeft } from '@/components/elements/icon'; | ||
import { Image } from '@/components/elements/image'; | ||
import { Link } from '@/components/elements/link'; | ||
import Stack from '@/components/elements/stack'; | ||
import { Text } from '@/components/elements/text'; | ||
import { formatDateLongMonthYear } from '@/lib/utils/formatMonthYearDate'; | ||
|
||
interface SinglePostHeroProps { | ||
post: Post; | ||
} | ||
|
||
const GoBack = ({ $displayOn }: { $displayOn: 'desktop' | 'mobile' }) => { | ||
return ( | ||
<StyledGoBack $displayOn={$displayOn}> | ||
<Link href="/blog"> | ||
<CaretLeft weight="fill" /> | ||
<Text as="label" fontSize="m" fontWeight="bold"> | ||
GO BACK TO BLOG | ||
</Text> | ||
</Link> | ||
</StyledGoBack> | ||
); | ||
}; | ||
|
||
export const SinglePostHero = ({ post }: SinglePostHeroProps) => { | ||
const formatteDate = formatDateLongMonthYear(post.date); | ||
|
||
return ( | ||
<StyledSinglePost> | ||
<StyledSinglePostDetails> | ||
<GoBack $displayOn="desktop" /> | ||
<Stack $gap="16px"> | ||
<StyledTags>{post.tags.length && post.tags.map((tag: string) => <Badge>{tag}</Badge>)}</StyledTags> | ||
<Heading fontSize="l" fontWeight="normal" color="white"> | ||
{post.title} | ||
</Heading> | ||
</Stack> | ||
<StyledPostMeta> | ||
<Text as="span" fontSize="l" color="darkGrey"> | ||
{formatteDate} | ||
</Text> | ||
{post.author && ( | ||
<Text as="span" fontSize="l" color="darkGrey"> | ||
Author: {post.author.name} | ||
</Text> | ||
)} | ||
</StyledPostMeta> | ||
</StyledSinglePostDetails> | ||
|
||
<StyledSinglePostImageWrapper> | ||
<GoBack $displayOn="mobile" /> | ||
<Image width={607} height={296} src={`images/${post.coverImage}`} alt={post.title} priority /> | ||
</StyledSinglePostImageWrapper> | ||
</StyledSinglePost> | ||
); | ||
}; |
98 changes: 98 additions & 0 deletions
98
src/components/sections/blog/single-post-hero/single-post-hero.styles.ts
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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
'use client'; | ||
|
||
import { css, screens, styled } from '@/styles'; | ||
|
||
export const StyledSinglePost = styled.div` | ||
display: flex; | ||
flex-direction: column-reverse; | ||
align-items: center; | ||
justify-content: space-between; | ||
gap: 32px; | ||
border-radius: 12px; | ||
padding: 16px; | ||
margin-top: 32px; | ||
background-color: ${({ theme }) => theme.colors.inkBlack}; | ||
box-shadow: | ||
0 0 0 1px ${({ theme }) => theme.colors.button.border}, | ||
0 0 8px 0 ${({ theme }) => theme.colors.shadowDefault}; | ||
margin-bottom: 24px; | ||
@media (min-width: ${screens['lg']}) { | ||
padding: 32px; | ||
align-items: normal; | ||
margin-top: 64px; | ||
flex-direction: row; | ||
gap: 64px; | ||
} | ||
`; | ||
|
||
export const StyledGoBack = styled.div<{ $displayOn: 'mobile' | 'desktop' }>` | ||
display: none; | ||
& a { | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
} | ||
${({ $displayOn }) => | ||
$displayOn === 'desktop' && | ||
css` | ||
@media (min-width: ${screens['lg']}) { | ||
display: block; | ||
} | ||
`} | ||
${({ $displayOn }) => | ||
$displayOn === 'mobile' && | ||
css` | ||
@media (max-width: ${screens['lg']}) { | ||
display: block; | ||
margin-top: 16px; | ||
margin-bottom: 32px; | ||
} | ||
`} | ||
`; | ||
|
||
export const StyledPostMeta = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; | ||
|
||
export const StyledSinglePostImageWrapper = styled.div` | ||
width: 100%; | ||
& img { | ||
border-radius: 8px; | ||
overflow: hidden; | ||
max-height: 174px; | ||
@media (min-width: ${screens['lg']}) { | ||
max-height: fit-content; | ||
} | ||
} | ||
@media (min-width: ${screens['lg']}) { | ||
max-width: 607px; | ||
min-width: 607px; | ||
} | ||
`; | ||
|
||
export const StyledSinglePostDetails = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
gap: 24px; | ||
`; | ||
|
||
export const StyledTags = styled.div` | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 16px; | ||
@media (min-width: ${screens['lg']}) { | ||
display: none; | ||
visibility: hidden; | ||
} | ||
`; |
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
2 changes: 1 addition & 1 deletion
2
src/content/posts/android-14-breaks-system-certificate-installation.md
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
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
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
Oops, something went wrong.