Skip to content

Commit 07519e0

Browse files
thiskevinwangtimdorr
authored andcommitted
convert footer.js to function component (#1466)
1 parent a84eec9 commit 07519e0

File tree

1 file changed

+86
-89
lines changed

1 file changed

+86
-89
lines changed

website/core/Footer.js

Lines changed: 86 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -7,105 +7,102 @@
77

88
const React = require("react");
99

10-
class Footer extends React.Component {
11-
docUrl(doc, language) {
12-
const baseUrl = this.props.config.baseUrl;
10+
const Footer = ({ config }) => {
11+
const docUrl = (doc, language) => {
12+
const baseUrl = config.baseUrl;
1313
return `${baseUrl}${language ? `${language}/` : ""}${doc}`;
1414
}
1515

16-
pageUrl(doc, language) {
17-
const baseUrl = this.props.config.baseUrl;
16+
const pageUrl = (doc, language) => {
17+
const baseUrl = config.baseUrl;
1818
return baseUrl + (language ? `${language}/` : "") + doc;
1919
}
20-
21-
render() {
22-
return (
23-
<footer className="nav-footer" id="footer">
24-
<section className="sitemap">
25-
<a href={this.props.config.baseUrl} className="nav-home">
26-
{this.props.config.footerIcon && (
27-
<img
28-
src={this.props.config.baseUrl + this.props.config.footerIcon}
29-
alt={this.props.config.title}
30-
width="66"
31-
height="58"
32-
/>
20+
return (
21+
<footer className="nav-footer" id="footer">
22+
<section className="sitemap">
23+
<a href={config.baseUrl} className="nav-home">
24+
{config.footerIcon && (
25+
<img
26+
src={config.baseUrl + config.footerIcon}
27+
alt={config.title}
28+
width="66"
29+
height="58"
30+
/>
31+
)}
32+
</a>
33+
<div>
34+
<h5>Docs</h5>
35+
<a href={docUrl("introduction/quick-start")}>Introduction</a>
36+
<a
37+
href={docUrl(
38+
"using-react-redux/connect-mapstate"
3339
)}
40+
>
41+
Using React Redux
3442
</a>
35-
<div>
36-
<h5>Docs</h5>
37-
<a href={this.docUrl("introduction/quick-start")}>Introduction</a>
38-
<a
39-
href={this.docUrl(
40-
"using-react-redux/connect-mapstate"
41-
)}
42-
>
43-
Using React Redux
44-
</a>
45-
<a href={this.docUrl("api/connect")}>API Reference</a>
46-
<a href={this.docUrl("troubleshooting")}>Guides</a>
47-
</div>
48-
<div>
49-
<h5>Community</h5>
50-
<a
51-
href="http://stackoverflow.com/questions/tagged/react-redux"
52-
target="_blank"
53-
rel="noreferrer noopener"
54-
>
55-
Stack Overflow
56-
</a>
57-
<a href="https://discord.gg/0ZcbPKXt5bZ6au5t">
58-
Discord
59-
</a>
60-
</div>
61-
<div>
62-
<h5>More</h5>
63-
<a href="https://github.com/reduxjs/react-redux/">GitHub</a>
64-
<a
65-
className="github-button"
66-
href={this.props.config.repoUrl}
67-
data-icon="octicon-star"
68-
data-count-href="/reduxjs/react-redux/stargazers"
69-
data-show-count="true"
70-
data-count-aria-label="# stargazers on GitHub"
71-
aria-label="Star this project on GitHub"
72-
>
73-
Star
74-
</a>
75-
</div>
76-
</section>
77-
<section className="copyright">
78-
{this.props.config.copyright}<br />
79-
Some icons copyright <a
80-
href="https://fontawesome.com/license/free"
81-
style={{color : "white"}}
43+
<a href={docUrl("api/connect")}>API Reference</a>
44+
<a href={docUrl("troubleshooting")}>Guides</a>
45+
</div>
46+
<div>
47+
<h5>Community</h5>
48+
<a
49+
href="http://stackoverflow.com/questions/tagged/react-redux"
50+
target="_blank"
51+
rel="noreferrer noopener"
8252
>
83-
Font Awesome
84-
</a> and <a
85-
href="https://thenounproject.com"
86-
style={{color : "white"}}
87-
>
88-
Noun Project
89-
</a> (<a
90-
href="https://thenounproject.com/term/certificate/1945625/"
91-
style={{color : "white"}}
92-
>
93-
prasong tadoungsorn
94-
</a>, <a
95-
href="https://thenounproject.com/term/box/1664404/"
96-
style={{color : "white"}}
97-
>
98-
Vladimir Belochkin
99-
</a>, <a
100-
href="https://thenounproject.com/term/rocket/1245262/"
53+
Stack Overflow
54+
</a>
55+
<a href="https://discord.gg/0ZcbPKXt5bZ6au5t">
56+
Discord
57+
</a>
58+
</div>
59+
<div>
60+
<h5>More</h5>
61+
<a href="https://github.com/reduxjs/react-redux/">GitHub</a>
62+
<a
63+
className="github-button"
64+
href={config.repoUrl}
65+
data-icon="octicon-star"
66+
data-count-href="/reduxjs/react-redux/stargazers"
67+
data-show-count="true"
68+
data-count-aria-label="# stargazers on GitHub"
69+
aria-label="Star this project on GitHub"
70+
>
71+
Star
72+
</a>
73+
</div>
74+
</section>
75+
<section className="copyright">
76+
{config.copyright}<br />
77+
Some icons copyright <a
78+
href="https://fontawesome.com/license/free"
10179
style={{color : "white"}}
10280
>
103-
Atif Arshad
104-
</a>)
105-
</section>
106-
</footer>
107-
);
108-
}
81+
Font Awesome
82+
</a> and <a
83+
href="https://thenounproject.com"
84+
style={{color : "white"}}
85+
>
86+
Noun Project
87+
</a> (<a
88+
href="https://thenounproject.com/term/certificate/1945625/"
89+
style={{color : "white"}}
90+
>
91+
prasong tadoungsorn
92+
</a>, <a
93+
href="https://thenounproject.com/term/box/1664404/"
94+
style={{color : "white"}}
95+
>
96+
Vladimir Belochkin
97+
</a>, <a
98+
href="https://thenounproject.com/term/rocket/1245262/"
99+
style={{color : "white"}}
100+
>
101+
Atif Arshad
102+
</a>)
103+
</section>
104+
</footer>
105+
);
109106
}
110107

111108
module.exports = Footer;

0 commit comments

Comments
 (0)