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.
86
86
- Blog page which pulls content from dev.to
87
87
- Search functionality for blog posts
88
88
- Styled components to Title component
89
+ - Links to blog tags to show all posts with the same tag
89
90
90
91
### Fixed
91
92
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const BlogPostsContainer = ({
19
19
tag,
20
20
swipe = true ,
21
21
viewall = true ,
22
+ back = false ,
22
23
} ) => {
23
24
// process posts props (e.g. insert default image)
24
25
posts . map ( post => {
@@ -51,7 +52,7 @@ const BlogPostsContainer = ({
51
52
) : (
52
53
< Container >
53
54
< div className = { styles . postContainer } >
54
- { posts . map ( ( p , index ) => (
55
+ { posts ? .map ( ( p , index ) => (
55
56
< Card customClass = 'blog' key = { index } card = { p } />
56
57
) ) }
57
58
</ div >
@@ -61,13 +62,23 @@ const BlogPostsContainer = ({
61
62
{ viewall && posts . length >= 3 ? (
62
63
< Container >
63
64
< Link
64
- className = { styles . viewAll }
65
+ className = { ` ${ styles . bottomLink } ${ styles . viewAll } ` }
65
66
href = { tag ? `/blog/category/${ tag } ` : '/blog/category/all' }
66
67
>
67
68
view all
68
69
</ Link >
69
70
</ Container >
70
71
) : 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 }
71
82
</ div >
72
83
</ RevealContentContainer >
73
84
) ;
Original file line number Diff line number Diff line change 1
1
import styles from '@/styles/Blog.module.scss' ;
2
+ import Link from 'next/link' ;
2
3
3
4
const 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
+ ) ;
5
10
} ;
6
11
7
12
export default Tag ;
Original file line number Diff line number Diff line change @@ -6,13 +6,17 @@ import { blogRevalidate } from '@/utils/config';
6
6
export default function BlogCategory ( { posts } ) {
7
7
const router = useRouter ( ) ;
8
8
const { tag } = router . query ;
9
+
9
10
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
+ </ >
16
20
) ;
17
21
}
18
22
@@ -41,6 +45,6 @@ export async function getStaticProps({ params }) {
41
45
export async function getStaticPaths ( ) {
42
46
return {
43
47
paths,
44
- fallback : false ,
48
+ fallback : 'blocking' ,
45
49
} ;
46
50
}
Original file line number Diff line number Diff line change 7
7
margin : 3rem 0 ;
8
8
}
9
9
10
- .viewAll {
10
+ .bottomLink {
11
11
font-size : 1.5rem ;
12
12
font-weight : bold ;
13
13
position : relative ;
14
- top : -3rem ;
15
14
display : block ;
16
15
text-align : center ;
16
+ }
17
17
18
+ .viewAll {
19
+ top : -3rem ;
18
20
@include desktop {
19
21
float : right ;
20
22
top : -5rem ;
21
23
}
22
24
}
23
25
26
+ .backLink {
27
+ top : -2rem ;
28
+
29
+ @include desktop {
30
+ float : left ;
31
+ top : -1rem ;
32
+ }
33
+ }
34
+
24
35
.blogSearch {
25
36
display : flex ;
26
37
padding-top : 2.5rem ;
84
95
padding : 0.5rem 1rem ;
85
96
border-radius : 2rem ;
86
97
font-weight : bold ;
98
+ text-decoration : none !important ;
87
99
}
You can’t perform that action at this time.
0 commit comments