Skip to content

Commit 0db1108

Browse files
committed
added
1 parent 7df2ba0 commit 0db1108

File tree

5 files changed

+40
-104
lines changed

5 files changed

+40
-104
lines changed

README.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
11

22
# 10secondsofcode
3-
10secondsofcode is a easy way to understand the reactjs snippets in 10 seconds. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2F10secondsofcode%2F10secondsofcode.svg?type=small)](https://app.fossa.io/projects/git%2Bgithub.com%2F10secondsofcode%2F10secondsofcode?ref=badge_small)
4-
5-
*Website :* [https://10secondsofcode.github.io/10secondsofcode/](https://10secondsofcode.github.io/10secondsofcode/)
6-
7-
## Getting Started
8-
9-
```
10-
git clone https://github.com/10secondsofcode/10secondsofcode.git
11-
npm install
12-
npm start
13-
```
14-
15-
## Built With
16-
17-
* [ReactJs](https://github.com/reactjs)
18-
* [BootStrap4](https://getbootstrap.com/docs/4.1/getting-started/introduction/)
19-
20-
## Contributing
21-
22-
If you have any idea for an improvement or found a bug, do not hesitate to open an issue. And if you have time clone this repo and submit a pull request and help me make *10secondsofcode*, we all dream about! Please read [CONTRIBUTING.md](https://github.com/10secondsofcode/10secondsofcode/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
23-
24-
## Authors
25-
26-
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
27-
28-
## License
29-
30-
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
31-
3+
10secondsofcode is a easy way to understand the reactjs snippets in 10 seconds.
324
## Acknowledgments
335

346
* Hat tip to anyone whose code was used

docs/README.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
11

2-
# 10secondsofcode
3-
10secondsofcode is a easy way to understand the reactjs snippets in 10 seconds. [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2F10secondsofcode%2F10secondsofcode.svg?type=small)](https://app.fossa.io/projects/git%2Bgithub.com%2F10secondsofcode%2F10secondsofcode?ref=badge_small)
4-
5-
*Website :* [https://10secondsofcode.github.io/10secondsofcode/](https://10secondsofcode.github.io/10secondsofcode/)
6-
7-
## Getting Started
8-
9-
```
10-
git clone https://github.com/10secondsofcode/10secondsofcode.git
11-
npm install
12-
npm start
13-
```
14-
15-
## Built With
16-
17-
* [ReactJs](https://github.com/reactjs)
18-
* [BootStrap4](https://getbootstrap.com/docs/4.1/getting-started/introduction/)
19-
20-
## Contributing
21-
22-
If you have any idea for an improvement or found a bug, do not hesitate to open an issue. And if you have time clone this repo and submit a pull request and help me make *10secondsofcode*, we all dream about! Please read [CONTRIBUTING.md](https://github.com/10secondsofcode/10secondsofcode/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
23-
24-
## Authors
25-
26-
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
27-
28-
## License
29-
30-
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
31-
322
## Acknowledgments
333

344
* Hat tip to anyone whose code was used
File renamed without changes.
File renamed without changes.

src/App.js

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,11 @@ import Herocontent from './Components/Herocontent';
77
import ReactMarkdown from 'react-markdown';
88
import AppMarkdown from '../README.md';
99

10-
// const importAll = (r) => r.keys().map(r);
11-
// const markdownFiles = importAll(require.context('../docs', false, /\.md$/))
12-
// .sort()
13-
// .reverse();
14-
15-
//console.log("markdownFiles====>"+markdownFiles);
16-
17-
// const markdownContext = require.context('../docs', false, /\.md$/);
18-
// console.log(markdownContext.keys());
19-
20-
// function importAll (r) {
21-
// r.keys().forEach(r);
22-
// }
23-
24-
/* importAll(require.context('../docs/', true, /\.js$/));
25-
2610
const markdownContext = require.context('../docs', false, /\.md$/);
2711
const markdownFiles = markdownContext
2812
.keys()
29-
.map((filename) => markdownContext(filename))
30-
console.log(markdownFiles); */
31-
32-
const importAll = (r) => r.keys().map(r);
33-
const markdownFiles = importAll(require.context('../docs/', false, /\.md$/));
13+
//.map((filename) => markdownContext(filename))
14+
console.log("hey"+markdownFiles);
3415

3516
class App extends React.Component {
3617
constructor(props){
@@ -39,32 +20,45 @@ class App extends React.Component {
3920
count : 5,
4021
posts: ''
4122
}
42-
this.increment = this.increment.bind(this);
43-
this.decrement = this.decrement.bind(this);
4423
}
4524

46-
async componentDidMount() {
47-
console.log(markdownFiles);
48-
const posts = markdownFiles
49-
50-
this.setState((state) => ({ ...state, posts }));
51-
}
25+
componentDidMount() {
26+
console.log("mark files===>"+markdownFiles);
27+
var newPosts = [];
28+
const posts = markdownFiles.forEach(
29+
(file, key ) => {
30+
newPosts.push({
31+
id: key,
32+
data: "."+file
33+
});
34+
}
35+
);
5236

53-
increment() {
54-
this.setState(
55-
{count : this.state.count+1}
56-
);
57-
}
58-
59-
decrement() {
60-
this.setState(
61-
{count : this.state.count-1}
62-
);
37+
console.log("posts array value ==>"+JSON.stringify(newPosts))
38+
const posts1 = Promise.all(
39+
newPosts.forEach(
40+
(file, key ) => {
41+
console.log("---> "+file.data+" ,==="+key)
42+
fetch(file.data)
43+
.then( res => res.text() )
44+
.then(
45+
text =>
46+
{
47+
console.log("text===>"+text);
48+
//this.setState({ posts1: text });
49+
}
50+
)
51+
}
52+
)
53+
) ;
54+
//console.log("posts array value ==>"+JSON.stringify(posts1))
55+
//console.log("posts array value ==>"+JSON.stringify(newPosts))
56+
//this.setState((state) => ({ ...state, posts }));
6357
}
6458

6559
render() {
66-
const { posts } = this.state;
67-
//console.log("post===>"+posts);
60+
//const { newPosts } = this.state;
61+
//console.log("posts array value ==>"+JSON.stringify(newPosts))
6862
return (
6963
<div>
7064
<Navigation />
@@ -77,10 +71,10 @@ class App extends React.Component {
7771
<div className="card-content">
7872
<div className="content">
7973
{
80-
//posts.map((post, idx) => (
81-
<ReactMarkdown source={posts} />
82-
//))
83-
}
74+
//newPosts.map((post, idx) => (
75+
76+
// ))
77+
}
8478
</div>
8579
</div>
8680
</div>

0 commit comments

Comments
 (0)