File tree 9 files changed +109
-37
lines changed
9 files changed +109
-37
lines changed Original file line number Diff line number Diff line change 8
8
"@testing-library/user-event" : " ^7.2.1" ,
9
9
"react" : " ^16.13.1" ,
10
10
"react-dom" : " ^16.13.1" ,
11
- "react-scripts" : " 3.4.3"
11
+ "react-scripts" : " 3.4.3" ,
12
+ "svg-loaders-react" : " ^2.2.1"
12
13
},
13
14
"scripts" : {
14
15
"start" : " react-scripts start" ,
Original file line number Diff line number Diff line change 14
14
manifest.json provides metadata used when your web app is installed on a
15
15
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
16
-->
17
+ < link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css ">
18
+
17
19
< link rel ="manifest " href ="%PUBLIC_URL%/manifest.json " />
18
20
<!--
19
21
Notice the use of %PUBLIC_URL% in the tags above.
24
26
work correctly both with client-side routing and a non-root public URL.
25
27
Learn how to configure a non-root public URL by running `npm run build`.
26
28
-->
27
- < title > React App </ title >
29
+ < title > API-hashnode </ title >
28
30
</ head >
29
31
< body >
30
32
< noscript > You need to enable JavaScript to run this app.</ noscript >
Original file line number Diff line number Diff line change 5
5
max-width : 900px ;
6
6
margin : auto;
7
7
}
8
+
9
+ .spinner {
10
+ margin : auto;
11
+ justify-content : center;
12
+ text-align : center;
13
+ padding-top : 250px ;
14
+ }
15
+
16
+ .nav {
17
+ color : # 344051 ;
18
+ font-family : segoe ui;
19
+ display : flex;
20
+ flex-direction : row;
21
+ max-width : 750px ;
22
+ margin : auto;
23
+ padding : 10px 20px 0px 20px ;
24
+ text-align : center;
25
+
26
+ }
27
+ .icons {
28
+ margin-top : 15px ;
29
+ margin-left : auto;
30
+ margin-right : 0px ;
31
+
32
+ }
33
+ i {
34
+ color : # 444e67 ;
35
+ margin : 5px ;;
36
+
37
+ }
38
+
39
+ .card {
40
+ height : auto;
41
+ width : 350px ;
42
+ padding : 20px ;
43
+ font-family : segoe ui;
44
+ border : solid 2px # f2f2f2 ;
45
+ text-align : inherit;
46
+ margin : 20px ;
47
+ background-color : # ffffff ;
48
+ box-shadow : 2px 2px 4px # f2f2f2 ;
49
+ border-radius : 8px ;
50
+ }
51
+ p {
52
+ color : # 333333 ;
53
+ }
54
+
55
+ h2 {
56
+ font-weight : 600 ;
57
+ }
58
+ img {
59
+
60
+ width : inherit;
61
+ height : inherit;
62
+ border-radius : 5px ;
63
+ }
64
+
65
+ a {
66
+ text-decoration : none;
67
+ color : # 1d1d1d ;
68
+ }
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import './App.css' ;
3
- import BlogPosts from './BlogPosts'
3
+ import BlogPosts from './BlogPosts' ;
4
+ import NavBar from './NavBar' ;
4
5
5
6
function App ( ) {
6
7
return (
7
8
< div >
8
- < BlogPosts />
9
+ < NavBar />
10
+ < BlogPosts />
9
11
</ div >
10
12
) ;
11
13
}
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import Post from './Post' ;
3
3
import './App.css' ;
4
+ import { ThreeDots } from 'svg-loaders-react'
5
+
4
6
5
7
const query = `
6
8
{
@@ -19,7 +21,8 @@ const query = `
19
21
20
22
class Blogposts extends React . Component {
21
23
state = {
22
- posts : [ ]
24
+ posts : [ ] ,
25
+ loading : true
23
26
} ;
24
27
25
28
componentDidMount ( ) {
@@ -37,23 +40,25 @@ class Blogposts extends React.Component {
37
40
const ApiResponse = await response . json ( ) ;
38
41
39
42
console . log ( ApiResponse . data . user . publication . posts ) ;
40
- this . setState ( { posts : ApiResponse . data . user . publication . posts } ) ;
43
+ this . setState ( { posts : ApiResponse . data . user . publication . posts , loading : false } ) ;
41
44
42
45
43
46
} ;
44
47
45
48
render ( ) {
49
+
50
+ if ( this . state . loading ) return < div className = "spinner" > < ThreeDots fill = "#e1bafd" trokeOpacity = ".125" /> </ div > ;
51
+
46
52
return (
47
53
< div class = "container" >
48
54
{ this . state . posts . map ( ( post , index ) => (
49
- < a key = { index } href = { `https://blog.rutikwankhade.dev/${ post . slug } ` } >
50
- < Post post = { post } />
55
+ < a key = { index } href = { `https://blog.rutikwankhade.dev/${ post . slug } ` } >
56
+ < Post post = { post } />
51
57
</ a >
52
58
) ) }
53
59
</ div >
54
60
) ;
55
61
}
56
62
}
57
63
58
-
59
64
export default Blogposts ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import './App.css' ;
3
+
4
+ const NavBar = ( ) => {
5
+
6
+ return (
7
+ < div className = "nav" >
8
+ < h2 > Rutik Wankhade</ h2 >
9
+ < div className = "icons" >
10
+ < a href = "https://github.com/rutikwankhade/API-hashnode" >
11
+ < i class = "fa fa-2x fa-github-alt" aria-hidden = "true" > </ i >
12
+ </ a >
13
+ < a href = "https://github.com/rutikwankhade/API-hashnode" >
14
+ < i class = "fa fa-2x fa-twitter" aria-hidden = "true" > </ i >
15
+ </ a >
16
+ </ div >
17
+ </ div >
18
+ ) ;
19
+ }
20
+
21
+ export default NavBar ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import './Post.css'
2
+ import './App.css'
3
+
3
4
const Post = ( { post } ) => {
4
5
return (
5
6
< div className = "card" >
6
- < img src = { post . coverImage } alt = { post . title } />
7
+ < img src = { post . coverImage } alt = { post . title } />
7
8
< h2 > { post . title } </ h2 >
8
9
< p > { post . brief } </ p >
9
10
</ div >
You can’t perform that action at this time.
0 commit comments