11import React , { Fragment , Component } from "react" ;
22import { Button } from 'reactstrap' ;
3-
3+ import { BrowserRouter , Route } from 'react-router-dom' ;
44import Navigation from './Components/Navigation' ;
55import Main from './Components/Main' ;
66import Herocontent from './Components/Herocontent' ;
@@ -10,51 +10,50 @@ import AppMarkdown from '../README.md';
1010const markdownContext = require . context ( '../docs' , false , / \. m d $ / ) ;
1111const markdownFiles = markdownContext
1212 . keys ( )
13- //.map((filename) => markdownContext(filename))
13+ //.map((filename) => markdownContext(filename))
1414//console.log("hey"+markdownFiles);
1515
1616class App extends React . Component {
17- constructor ( props ) {
17+ constructor ( props ) {
1818 super ( props ) ;
1919 this . state = {
20- count : 5 ,
21- posts1 : [ ]
22- }
20+ count : 5 ,
21+ posts1 : [ ]
22+ }
2323 }
24-
24+
2525 componentDidMount ( ) {
2626 var newPosts = [ ] ;
2727 const posts = markdownFiles . forEach (
28- ( file , key ) => {
29- newPosts . push ( {
30- id : key ,
31- data : "." + file
32- } ) ;
33- }
34- ) ;
28+ ( file , key ) => {
29+ newPosts . push ( {
30+ id : key ,
31+ data : "." + file
32+ } ) ;
33+ }
34+ ) ;
3535
3636 newPosts . map (
37- ( post ) =>
38- {
39- let a = 10 ;
40- console . log ( "new values===>" + post . data ) ;
41- let av = this . apiGetAll ( post . data ) ;
42- console . log ( "json--->" + JSON . stringify ( av ) ) ;
43- }
44- ) ;
37+ ( post ) => {
38+ let a = 10 ;
39+ console . log ( "new values===>" + post . data ) ;
40+ let av = this . apiGetAll ( post . data ) ;
41+ console . log ( "json--->" + JSON . stringify ( av ) ) ;
42+ }
43+ ) ;
4544 //this.apiGetAll(newPosts["data"]);
4645 return false ;
4746 }
4847
49- async apiGetAll ( newPosts ) {
48+ async apiGetAll ( newPosts ) {
5049 let cc = [ ] ;
5150 try {
52- const resp = await fetch ( newPosts ) . then ( res => res . text ( ) ) ;
53- console . log ( "fetch---" + resp ) ;
51+ const resp = await fetch ( newPosts ) . then ( res => res . text ( ) ) ;
52+ console . log ( "fetch---" + resp ) ;
5453 cc . push ( {
55- data : resp
54+ data : resp
5655 } ) ;
57- console . log ( "json--->" + JSON . stringify ( cc ) ) ;
56+ console . log ( "json--->" + JSON . stringify ( cc ) ) ;
5857 /* const newResp = await Promise.all((resp)).then(result => {
5958 console.log("hey--->"+result);
6059 this.setState({posts1: result});
@@ -65,7 +64,7 @@ class App extends React.Component {
6564 } catch ( err ) {
6665 console . log ( err ) ;
6766 }
68- }
67+ }
6968
7069 /*getFileResults(newPosts) {
7170 let data = [];
@@ -92,30 +91,32 @@ class App extends React.Component {
9291 });
9392 }*/
9493
95- render ( ) {
94+ render ( ) {
9695 return (
9796 < div >
98- < Navigation />
99- < Herocontent />
100- < Main />
101- < Fragment >
102- < section className = "section" >
103- < div className = "container" >
104- < div className = "card" >
105- < div className = "card-content" >
106- < div className = "content" >
107- {
108- //newPosts.map((post, idx) => (
109- // this.state.posts1
110- // ))
111- }
112- < ReactMarkdown source = { this . state . posts1 } />
97+ < BrowserRouter >
98+ < Navigation />
99+ < Herocontent />
100+ < Route exact path = "/" component = { Main } />
101+ < Fragment >
102+ < section className = "section" >
103+ < div className = "container" >
104+ < div className = "card" >
105+ < div className = "card-content" >
106+ < div className = "content" >
107+ {
108+ //newPosts.map((post, idx) => (
109+ // this.state.posts1
110+ // ))
111+ }
112+ < ReactMarkdown source = { this . state . posts1 } />
113+ </ div >
113114 </ div >
114115 </ div >
115116 </ div >
116- </ div >
117- </ section >
118- </ Fragment >
117+ </ section >
118+ </ Fragment >
119+ </ BrowserRouter >
119120 </ div >
120121 ) ;
121122 }
0 commit comments