forked from ghuser-io/ghuser.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanding.js
More file actions
119 lines (112 loc) · 3.8 KB
/
Landing.js
File metadata and controls
119 lines (112 loc) · 3.8 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import React from 'react';
import {XmlEntities} from 'html-entities';
import * as Autolinker from 'autolinker';
import * as Parser from 'html-react-parser';
import * as db from '../db';
import {urls} from '../ghuser';
import Content from './Content';
import LogoWithPunchline from './LogoWithPunchline';
import NavBar from './NavBar';
import {Typing} from './utils/Typing'
import PageContent from './PageContent';
import './Landing.css';
import './All.css';
class Landing extends React.Component {
constructor(props) {
super(props);
this.state = {
meta: null,
featuredUsers: [{
login: 'AurelienLourot',
}, {
login: 'brillout',
}]
};
}
async componentDidMount() {
const meta = await (await fetch(`${db.url}/meta.json`)).json();
this.setState({
meta,
});
const newFeaturedUsers = [...this.state.featuredUsers];
for (const i in newFeaturedUsers) {
const userId = newFeaturedUsers[i].login.toLowerCase();
const userData = await fetch(`${db.url}/users/${userId}.json`);
newFeaturedUsers[i] = await userData.json();
this.setState({
featuredUsers: newFeaturedUsers
});
}
}
render() {
const cards = this.state.featuredUsers.filter(user => user.avatar_url).map(user => (
<div key={user.login} className="card">
<div className="crop-img">
<img className="card-img-top" src={user.avatar_url} alt="avatar" />
</div>
<div className="card-body">
<h5 className="card-title">{user.name}</h5>
<p className="card-text">{
Parser(Autolinker.link((new XmlEntities).encode(user.bio), {
className: 'external'
}))
}</p>
<a href={user.login} className="btn btn-primary">See this example</a>
</div>
</div>
));
return (
<PageContent>
<NavBar/>
<div className="jumbotron">
<Content>
<div className="container-lg">
<LogoWithPunchline classes="landing-logo" /><br />
<div className="ml-3">
<p>
We love the default GitHub profiles and we want to enhance them.
<a href={urls.mainRepo} target="_blank" className="landing-to-github external ml-3">
More on GitHub
</a>
{
this.state.meta &&
<span>
<br />
We are currently refreshing {this.state.meta.num_contribs}
contributions daily on {this.state.meta.num_users} user profiles.
</span> || ''
}
</p>
<a className="btn btn-primary ml-2 mr-4" href={urls.oauthEndpoint}
role="button">Get your profile</a>
<a className="ghuser-url-example" href={this.state.featuredUsers[0].login}>
{urls.landing}
/
<Typing
texts={[
'your-github-username',
...this.state.featuredUsers.map(user => user.login)
]}
/>
</a>
</div>
</div>
</Content>
</div>
<Content>
<div className="container-lg">
{cards}
<div className="m-4 made-with-reframe">
<a href="https://github.com/reframejs/reframe" target="_blank"
className="landing-to-reframe external">
<img src="https://avatars0.githubusercontent.com/u/36308163?v=4" />
Made with <i className="fa fa-heart"></i> and Reframe
</a>
</div>
</div>
</Content>
</PageContent>
);
}
}
export default Landing;