File tree 4 files changed +56
-2
lines changed
4 files changed +56
-2
lines changed Original file line number Diff line number Diff line change
1
+ .breadcrumbs {
2
+ span + span {
3
+ & :before {
4
+ content : ' >' ;
5
+ font-size : 12px ;
6
+ padding : 8px ;
7
+ }
8
+ }
9
+
10
+ span {
11
+ text-transform : capitalize ;
12
+ font-size : 14px ;
13
+ }
14
+
15
+ margin-bottom : 8px ;
16
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import PropTypes from 'prop-types' ;
3
+ import Link from 'next/link' ;
4
+ import styles from './breadcrumbs.module.scss' ;
5
+
6
+ const Breadcrumbs = ( { crumbs } ) => {
7
+ const lastCrumb = crumbs . pop ( ) ;
8
+
9
+ return (
10
+ < div className = { styles . breadcrumbs } >
11
+ < span >
12
+ < Link href = '/' > Home</ Link >
13
+ </ span >
14
+ { crumbs . map ( crumb => (
15
+ < span >
16
+ < Link href = { crumb . href } > { crumb . name } </ Link >
17
+ </ span >
18
+ ) ) }
19
+ < span > { lastCrumb . name } </ span >
20
+ </ div >
21
+ ) ;
22
+ } ;
23
+
24
+ Breadcrumbs . propTypes = {
25
+ crumbs : PropTypes . arrayOf (
26
+ PropTypes . shape ( { href : PropTypes . string , name : PropTypes . string } )
27
+ )
28
+ } ;
29
+
30
+ export default Breadcrumbs ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Layout from 'components/Layout';
7
7
import headerColor from 'helpers/post-header' ;
8
8
import styles from 'styles/post.module.scss' ;
9
9
import ProgressiveImage from 'components/ProgressiveImage' ;
10
+ import Breadcrumbs from 'components/Breadcrumbs' ;
10
11
11
12
export default function BlogPost ( {
12
13
siteTitle,
@@ -34,7 +35,13 @@ export default function BlogPost({
34
35
) }
35
36
< div className = 'container' >
36
37
< div className = { styles . post__header__title } >
37
- < h1 > { frontmatter . title } </ h1 >
38
+ < Breadcrumbs
39
+ crumbs = { [
40
+ { name : 'blog' , href : '/blog' } ,
41
+ { name : frontmatter . title }
42
+ ] }
43
+ />
44
+ < h2 > { frontmatter . title } </ h2 >
38
45
< div className = { styles . post__date_label } > { date } </ div >
39
46
</ div >
40
47
</ div >
Original file line number Diff line number Diff line change 28
28
position : relative ;
29
29
top : -34px ;
30
30
31
- h1 {
31
+ h2 {
32
32
margin-top : 0 ;
33
+ font-size : 2em ;
33
34
}
34
35
}
35
36
}
You can’t perform that action at this time.
0 commit comments