File tree Expand file tree Collapse file tree 5 files changed +45
-12
lines changed Expand file tree Collapse file tree 5 files changed +45
-12
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
8686- Blog page which pulls content from dev.to
8787- Search functionality for blog posts
8888- Styled components to Title component
89+ - Links to blog tags to show all posts with the same tag
8990
9091### Fixed
9192
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const BlogPostsContainer = ({
1919 tag,
2020 swipe = true ,
2121 viewall = true ,
22+ back = false ,
2223} ) => {
2324 // process posts props (e.g. insert default image)
2425 posts . map ( post => {
@@ -51,7 +52,7 @@ const BlogPostsContainer = ({
5152 ) : (
5253 < Container >
5354 < div className = { styles . postContainer } >
54- { posts . map ( ( p , index ) => (
55+ { posts ? .map ( ( p , index ) => (
5556 < Card customClass = 'blog' key = { index } card = { p } />
5657 ) ) }
5758 </ div >
@@ -61,13 +62,23 @@ const BlogPostsContainer = ({
6162 { viewall && posts . length >= 3 ? (
6263 < Container >
6364 < Link
64- className = { styles . viewAll }
65+ className = { ` ${ styles . bottomLink } ${ styles . viewAll } ` }
6566 href = { tag ? `/blog/category/${ tag } ` : '/blog/category/all' }
6667 >
6768 view all
6869 </ Link >
6970 </ Container >
7071 ) : null }
72+ { back ? (
73+ < Container >
74+ < Link
75+ className = { `${ styles . bottomLink } ${ styles . backLink } }` }
76+ href = { `/blog` }
77+ >
78+ < Back
79+ </ Link >
80+ </ Container >
81+ ) : null }
7182 </ div >
7283 </ RevealContentContainer >
7384 ) ;
Original file line number Diff line number Diff line change 11import styles from '@/styles/Blog.module.scss' ;
2+ import Link from 'next/link' ;
23
34const Tag = ( { text } ) => {
4- return < div className = { styles . tag } > { text } </ div > ;
5+ return (
6+ < Link className = { styles . tag } href = { `/blog/category/${ text } ` } >
7+ { text }
8+ </ Link >
9+ ) ;
510} ;
611
712export default Tag ;
Original file line number Diff line number Diff line change @@ -6,13 +6,17 @@ import { blogRevalidate } from '@/utils/config';
66export default function BlogCategory ( { posts } ) {
77 const router = useRouter ( ) ;
88 const { tag } = router . query ;
9+
910 return (
10- < BlogPostsContainer
11- posts = { posts }
12- swipe = { false }
13- heading = { tagToHeading [ tag ] }
14- viewall = { false }
15- />
11+ < >
12+ < BlogPostsContainer
13+ posts = { posts }
14+ swipe = { false }
15+ heading = { tagToHeading [ tag ] || `#${ tag } ` }
16+ viewall = { false }
17+ back = { true }
18+ />
19+ </ >
1620 ) ;
1721}
1822
@@ -41,6 +45,6 @@ export async function getStaticProps({ params }) {
4145export async function getStaticPaths ( ) {
4246 return {
4347 paths,
44- fallback : false ,
48+ fallback : 'blocking' ,
4549 } ;
4650}
Original file line number Diff line number Diff line change 77 margin : 3rem 0 ;
88}
99
10- .viewAll {
10+ .bottomLink {
1111 font-size : 1.5rem ;
1212 font-weight : bold ;
1313 position : relative ;
14- top : -3rem ;
1514 display : block ;
1615 text-align : center ;
16+ }
1717
18+ .viewAll {
19+ top : -3rem ;
1820 @include desktop {
1921 float : right ;
2022 top : -5rem ;
2123 }
2224}
2325
26+ .backLink {
27+ top : -2rem ;
28+
29+ @include desktop {
30+ float : left ;
31+ top : -1rem ;
32+ }
33+ }
34+
2435.blogSearch {
2536 display : flex ;
2637 padding-top : 2.5rem ;
8495 padding : 0.5rem 1rem ;
8596 border-radius : 2rem ;
8697 font-weight : bold ;
98+ text-decoration : none !important ;
8799}
You can’t perform that action at this time.
0 commit comments