-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathindex.js
91 lines (85 loc) · 2.39 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import React from 'react';
import Item from '../components/Item';
import Arrow from '../components/Icons/Arrow';
import Bookmark from '../components/Icons/Bookmark';
import Cog from '../components/Icons/Cog';
import Hamburger from '../components/Icons/Hamburger';
import Heart from '../components/Icons/Heart';
import Rupee from '../components/Icons/Rupee';
import Save from '../components/Icons/Save';
import Search from '../components/Icons/Search';
import Share from '../components/Icons/Share';
import User from '../components/Icons/User';
import Chevron from '../components/Icons/Chevron';
/**
* Home page
*
* @export
* @class IndexPage
* @extends {React.PureComponent}
*/
export default class IndexPage extends React.PureComponent {
state = {
items: [],
};
render() {
return (
<React.Fragment>
<style jsx>{`
ul {
padding: 0;
}
`}</style>
<main>
<img width="100%" src="/images/logo.png" alt="Logo of Upay NGO" />
<section>
The foundation of development for every society is the education of
its youth. Keeping this in mind, an
<a
href="https://www.upay.org.in/"
rel="noreferrer noopener"
target="_blank"
>
{' NGO UPAY '}
</a>
(Underprivileged Advancement by Youth), was established in May 2010
by a group of young engineers from IITs and NITs.
</section>
<h2>Items</h2>
<ul>
{this.state.items.map(
(item) => (
<Item
key={item.id}
{...item}
/>
)
)}
</ul>
<section>
<h1>Icons</h1>
<Arrow />
<Bookmark />
<Cog />
<Hamburger />
<Heart />
<Rupee />
<Save />
<Search />
<Share />
<User />
<Chevron direction={Chevron.DIRECTIONS.TOP} />
</section>
</main>
</React.Fragment>
);
}
/**
* This is for demo purposes.
* Once the component has mounted, we fetch items from our API and sets them to state.
*/
async componentDidMount() {
const { data: items } = await fetch('/api/items').then(r => r.json());
this.setState({ items });
}
}