Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b38a276

Browse files
Load Effi
1 parent 12fbb20 commit b38a276

File tree

5 files changed

+67
-39
lines changed

5 files changed

+67
-39
lines changed

‎src/App.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ export default class App extends Component {
1919
}
2020

2121
componentDidMount() {
22-
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=164&order=asc&per_page=30').then(({data}) => this.setState({basics: data})).catch((err)=>this.setState({basics: err}));
23-
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=158&order=asc&per_page=30').then(({data}) => this.setState({advance: data})).catch((err)=>this.setState({advance: err}));
24-
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=150&order=asc&per_page=30').then(({data}) => this.setState({es6: data})).catch((err)=>this.setState({es6: err}));
25-
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=168&order=asc&per_page=30').then(({data}) => this.setState({daily: data})).catch((err)=>this.setState({daily: err}));
26-
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=166&order=asc&per_page=30').then(({data}) => this.setState({soft: data})).catch((err)=>this.setState({soft: err}));
22+
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=164&order=asc&per_page=30&fields=id,title').then(({data}) => this.setState({basics: data}));
23+
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=158&order=asc&per_page=30&fields=id,title').then(({data}) => this.setState({advance: data}));
24+
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=150&order=asc&per_page=30&fields=id,title').then(({data}) => this.setState({es6: data}));
25+
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=168&order=asc&per_page=30&fields=id,title').then(({data}) => this.setState({daily: data}));
26+
axios('https://with.zonayed.me/wp-json/wp/v2/posts?tags=166&order=asc&per_page=30&fields=id,title').then(({data}) => this.setState({soft: data}));
2727
}
2828

2929
componentWillUnmount() {

‎src/component/Footer.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import React from 'react';
1+
import React,{PureComponent} from 'react';
22

3-
export default() => {
4-
return (
5-
<footer>
6-
<ul>
7-
<li>React</li>
8-
<li>React Router</li>
9-
<li>Axios</li>
10-
<li>Love</li>
11-
<li><a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn">with.zonayed.me</a></li>
12-
</ul>
13-
</footer>
14-
)
3+
export default class Footer extends PureComponent {
4+
render() {
5+
return (
6+
<footer>
7+
<ul>
8+
<li>React</li>
9+
<li>React Router</li>
10+
<li>Axios</li>
11+
<li>Love</li>
12+
<li><a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn">with.zonayed.me</a></li>
13+
</ul>
14+
</footer>
15+
)
16+
}
1517
}

‎src/component/Header.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import React from 'react';
1+
import React,{PureComponent} from 'react';
22

33
import logo from '../logo.png';
44

5-
export default() => {
6-
return (
7-
<header className="logo-area">
8-
<img src={logo} alt="Learn JavaScript" />
9-
<h3>Learn JavaScript with Zonayed</h3>
10-
</header>
11-
)
5+
export default class Footer extends PureComponent {
6+
render() {
7+
console.log('Header');
8+
return (
9+
<header className="logo-area">
10+
<img src={logo} alt="Learn JavaScript" />
11+
<h3>Learn JavaScript with Zonayed</h3>
12+
</header>
13+
)
14+
}
1215
}

‎src/component/Main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class Main extends Component {
2424
const {data: {basics, advance, es6, daily, soft}} = this.props;
2525
const { delayed } = this.state;
2626
const delayMsg = <span>I've got a bad server... If your internet connection is not slow, please reload</span>;
27-
27+
2828
return (
2929
<section className="content-area">
3030
{basics.length > 0 ? <Content title="JavaScript Basics" data={basics} color="#F0DB4F" topic="js-basic" /> : <div className="loading-bar"><BarLoader color={'#F0DB4F'} />{delayed ? delayMsg : ''}</div>}

‎src/component/SingleContent.js

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1-
import React from 'react';
1+
import React, { Component } from 'react';
2+
import axios from 'axios';
23
import { Link } from 'react-router-dom';
4+
import { BarLoader } from 'react-spinners';
35

46
import { createMarkup, toTop } from '../helper';
57

6-
export default({location: {state: {data}}}) => {
7-
toTop();
8-
return (
9-
<div className="single-content">
10-
<Link to="/" className="button">হোম</Link>
11-
<h1 className="title" dangerouslySetInnerHTML={createMarkup(data.title.rendered)} />
12-
<div className="post">
13-
<span dangerouslySetInnerHTML={createMarkup(data.content.rendered)}/>
14-
<p>আমার এই লেখা পূর্বে <a rel="noopener noreferrer" target="_blank" href={`${data.link}`}>আমার ব্লগে</a> প্রকাশিত হয়েছে। চাইলে <a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn">আমার ব্লগ</a> থেকে ঘুরে আসতে পারেন। ব্লগ থেকে <a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn/%E0%A6%B8%E0%A6%BE%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%95%E0%A7%8D%E0%A6%B0%E0%A6%BE%E0%A6%87%E0%A6%AC-%E0%A6%95%E0%A6%B0%E0%A7%81%E0%A6%A8/">সাবস্ক্রাইব</a> করলে আমি নিজে থেকেই আমার নতুন লেখাগুলো আপনার ইমেইলে প্রতি শুক্রবার সকালে পাঠিয়ে দিবো। ভালো থাকবেন। হ্যাপী প্রোগ্রামিং!</p>
8+
export default class SingleContent extends Component {
9+
state = {
10+
data: '',
11+
shouldUpdate: true
12+
}
13+
14+
componentWillMount() {
15+
const { props: { match: { params: { id } } } } = this;
16+
axios(`http://with.zonayed.me/wp-json/wp/v2/posts/${id}`).then(({data}) => this.setState({data, shouldUpdate: false}));
17+
toTop();
18+
}
19+
20+
shouldComponentUpdate() {
21+
const { state: { shouldUpdate }} = this;
22+
return shouldUpdate;
23+
}
24+
25+
render() {
26+
const { state: { data } } = this;
27+
if(!data) return <div className="loading-bar"><BarLoader /></div>
28+
29+
const { state: { data: { title, content, link } } } = this;
30+
return (
31+
<div className="single-content">
32+
<Link to="/" className="button">হোম</Link>
33+
<h1 className="title" dangerouslySetInnerHTML={createMarkup(title.rendered)} />
34+
<div className="post">
35+
<span dangerouslySetInnerHTML={createMarkup(content.rendered)}/>
36+
<p>আমার এই লেখা পূর্বে <a rel="noopener noreferrer" target="_blank" href={`${link}`}>আমার ব্লগে</a> প্রকাশিত হয়েছে। চাইলে <a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn">আমার ব্লগ</a> থেকে ঘুরে আসতে পারেন। ব্লগ থেকে <a rel="noopener noreferrer" target="_blank" href="https://with.zonayed.me/bn/%E0%A6%B8%E0%A6%BE%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%95%E0%A7%8D%E0%A6%B0%E0%A6%BE%E0%A6%87%E0%A6%AC-%E0%A6%95%E0%A6%B0%E0%A7%81%E0%A6%A8/">সাবস্ক্রাইব</a> করলে আমি নিজে থেকেই আমার নতুন লেখাগুলো আপনার ইমেইলে প্রতি শুক্রবার সকালে পাঠিয়ে দিবো। ভালো থাকবেন। হ্যাপী প্রোগ্রামিং!</p>
37+
</div>
1538
</div>
16-
</div>
17-
)
39+
)
40+
}
1841
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /