File tree 8 files changed +140
-16
lines changed
data-access-documents/src/lib 8 files changed +140
-16
lines changed Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "name" : " Juri Strumpflohner" ,
4
+ "image" : " /blog/images/Juri Strumpfloner.jpeg" ,
5
+ "twitter" : " juristr" ,
6
+ "github" : " juristr"
7
+ },
8
+ {
9
+ "name" : " Colum Ferry" ,
10
+ "image" : " /blog/images/Colum Ferry.jpeg" ,
11
+ "twitter" : " FerryColum" ,
12
+ "github" : " Coly010"
13
+ },
14
+ {
15
+ "name" : " Emily Xiong" ,
16
+ "image" : " /blog/images/Emily Xiong.jpeg" ,
17
+ "twitter" : " xiongemily" ,
18
+ "github" : " xiongemi"
19
+ },
20
+ {
21
+ "name" : " Isaac Mann" ,
22
+ "image" : " /blog/images/Isaac Mann.jpeg" ,
23
+ "twitter" : " mannisaac" ,
24
+ "github" : " isaacplmann"
25
+ },
26
+ {
27
+ "name" : " Katerina Skroumpelou" ,
28
+ "image" : " /blog/images/Katerina Skroumpelou.jpeg" ,
29
+ "twitter" : " psybercity" ,
30
+ "github" : " mandarini"
31
+ },
32
+ {
33
+ "name" : " Max Kless" ,
34
+ "image" : " /blog/images/Max Kless.jpeg" ,
35
+ "twitter" : " MaxKless" ,
36
+ "github" : " MaxKless"
37
+ },
38
+ {
39
+ "name" : " Victor Savkin" ,
40
+ "image" : " /blog/images/Victor Savkin.jpeg" ,
41
+ "twitter" : " victorsavkin" ,
42
+ "github" : " vsavkin"
43
+ },
44
+ {
45
+ "name" : " Zack DeRose" ,
46
+ "image" : " /blog/images/Zack DeRose.jpeg" ,
47
+ "twitter" : " zackderose" ,
48
+ "github" : " ZackDeRose"
49
+ }
50
+ ]
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ export class BlogApi {
21
21
22
22
getBlogPosts ( ) : BlogPostDataEntry [ ] {
23
23
const files : string [ ] = readdirSync ( this . options . blogRoot ) ;
24
+ const authors = JSON . parse (
25
+ readFileSync ( join ( this . options . blogRoot , 'authors.json' ) , 'utf8' )
26
+ ) ;
24
27
const allPosts : BlogPostDataEntry [ ] = [ ] ;
25
28
26
29
for ( const file of files ) {
@@ -35,7 +38,9 @@ export class BlogApi {
35
38
content,
36
39
title : frontmatter . title ?? null ,
37
40
description : frontmatter . description ?? null ,
38
- authors : frontmatter . authors ?? [ ] ,
41
+ authors : authors . filter ( ( author ) =>
42
+ frontmatter . authors . includes ( author . name )
43
+ ) ,
39
44
date : this . calculateDate ( file , frontmatter ) ,
40
45
cover_image : frontmatter . cover_image
41
46
? `/documentation${ frontmatter . cover_image } ` // Match the prefix used by markdown parser
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ export type BlogPostDataEntry = {
2
2
title : string ;
3
3
content : string ;
4
4
description : string ;
5
- authors : string [ ] ;
5
+ authors : BlogAuthor [ ] ;
6
6
date : string ;
7
7
cover_image : string | null ;
8
8
tags : string [ ] ;
@@ -12,3 +12,10 @@ export type BlogPostDataEntry = {
12
12
filePath : string ;
13
13
slug : string ;
14
14
} ;
15
+
16
+ export type BlogAuthor = {
17
+ name : string ;
18
+ image : string ;
19
+ twitter : string ;
20
+ github : string ;
21
+ } ;
Original file line number Diff line number Diff line change
1
+ import type { BlogAuthor } from '@nx/nx-dev/data-access-documents/node-only' ;
2
+ import { GithubIcon , TwitterIcon } from '@nx/nx-dev/ui-common' ;
3
+ import Image from 'next/image' ;
4
+
5
+ interface AuthorDetailProps {
6
+ author : BlogAuthor ;
7
+ }
8
+
9
+ export default function AuthorDetail ( { author } : AuthorDetailProps ) {
10
+ return (
11
+ < div className = "space-between invisible absolute left-[65%] right-0 z-30 mt-2 flex w-60 translate-x-[-50%] items-center gap-4 rounded bg-slate-50 p-4 text-sm text-slate-700 opacity-0 shadow-lg ring-1 ring-slate-200 transition-all delay-75 duration-300 ease-in-out md:group-hover:visible md:group-hover:opacity-100 dark:bg-slate-900 dark:text-slate-400 dark:ring-slate-800" >
12
+ < span >
13
+ < Image
14
+ alt = { author . name }
15
+ title = { author . name }
16
+ loading = "lazy"
17
+ width = "40"
18
+ height = "40"
19
+ decoding = "async"
20
+ src = { `/documentation/blog/images/authors/${ author . name } .jpeg` }
21
+ className = "rounded-full ring-1 ring-white grayscale dark:ring-slate-900"
22
+ />
23
+ </ span >
24
+ < span className = "text-balance" > { author . name } </ span >
25
+ < a
26
+ href = { `https://twitter.com/${ author . twitter } ` }
27
+ aria-label = { `Follow ${ author . name } on X` }
28
+ >
29
+ < TwitterIcon aria-hidden = "true" className = "h-5 w-5" />
30
+ </ a >
31
+ < a
32
+ href = { `https://github.com/${ author . github } ` }
33
+ aria-label = { `View ${ author . name } 's GitHub profile` }
34
+ >
35
+ < GithubIcon aria-hidden = "true" className = "h-5 w-5" />
36
+ </ a >
37
+ </ div >
38
+ ) ;
39
+ }
Original file line number Diff line number Diff line change 1
1
import Image from 'next/image' ;
2
+ import AuthorDetail from './author-detail' ;
3
+ import type { BlogAuthor } from '@nx/nx-dev/data-access-documents/node-only' ;
2
4
3
- export function BlogAuthors ( { authors } : { authors : string [ ] } ) : JSX . Element {
5
+ export function BlogAuthors ( {
6
+ authors,
7
+ } : {
8
+ authors : BlogAuthor [ ] ;
9
+ } ) : JSX . Element {
4
10
return (
5
- < div className = "isolate flex items-center -space-x-2 overflow-hidden " >
11
+ < div className = "relative isolate flex items-center -space-x-2" >
6
12
{ authors . map ( ( author , index ) => (
7
- < Image
8
- key = { index }
9
- alt = { author }
10
- title = { author }
11
- loading = "lazy"
12
- width = "48"
13
- height = "48"
14
- decoding = "async"
15
- src = { `/documentation/blog/images/authors/${ author } .jpeg` }
16
- className = "relative inline-block h-6 w-6 rounded-full ring-1 ring-white grayscale dark:ring-slate-900"
17
- />
13
+ < div key = { index } className = "group" >
14
+ < Image
15
+ alt = { author . name }
16
+ title = { author . name }
17
+ loading = "lazy"
18
+ width = "48"
19
+ height = "48"
20
+ decoding = "async"
21
+ src = { `/documentation/blog/images/authors/${ author . name } .jpeg` }
22
+ className = "relative inline-block h-6 w-6 rounded-full ring-1 ring-white grayscale dark:ring-slate-900"
23
+ />
24
+ < AuthorDetail author = { author } />
25
+ </ div >
18
26
) ) }
19
27
</ div >
20
28
) ;
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export function MoreBlogs({ blogs }: MoreBlogsProps) {
40
40
< span className = "hidden w-2/12 flex-none sm:inline-block" >
41
41
{ formattedDate }
42
42
</ span >
43
- < span className = "hidden w-2/12 flex-none sm:inline-block" >
43
+ < span className = "hidden flex-1 overflow-hidden sm:inline-block" >
44
44
< BlogAuthors authors = { post . authors } />
45
45
</ span >
46
46
</ Link >
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export * from './lib/typography';
20
20
export * from './lib/github-star-widget' ;
21
21
export * from './lib/youtube.component' ;
22
22
export * from './lib/image-theme' ;
23
+ export * from './lib/twitter-icon' ;
23
24
export { resourceMenuItems } from './lib/headers/menu-items' ;
24
25
export { solutionsMenuItems } from './lib/headers/menu-items' ;
25
26
export { eventItems } from './lib/headers/menu-items' ;
Original file line number Diff line number Diff line change
1
+ import { FC , SVGProps } from 'react' ;
2
+
3
+ export const TwitterIcon : FC < SVGProps < SVGSVGElement > > = ( props ) => (
4
+ < svg
5
+ fill = "currentColor"
6
+ role = "img"
7
+ preserveAspectRatio = "xMidYMid meet"
8
+ viewBox = "0 0 24 24"
9
+ xmlns = "http://www.w3.org/2000/svg"
10
+ { ...props }
11
+ >
12
+ < path d = "M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z" />
13
+ </ svg >
14
+ ) ;
You can’t perform that action at this time.
0 commit comments