-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
65 lines (58 loc) · 1.93 KB
/
App.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
import { AiOutlineEye } from 'react-icons/ai'
import { TbHandClick } from 'react-icons/tb'
import axios from 'axios'
import './App.css';
import { useState } from 'react';
import {Animated} from "react-animated-css";
function App() {
const [load, setLoad] = useState(false)
const [repos, setRepos] = useState([])
const getRepos = async () => {
try {
const response = await axios.get("https://api.github.com/orgs/frontendMentor-me/repos")
if (response.status === 200) {
setLoad(true)
setRepos(response.data)
console.log(response.data)
}
} catch (error) {
console.log("error: ", error.message)
}
}
if (!load) {
getRepos()
}
return (
<div className="App">
<h1>Frontendmentor repositories</h1>
<div className='repositories'>
{repos &&
repos.map((repo, index) =>
<Animated animationIn="fadeIn" isVisible={true}>
<div className='repository' key={index}>
<div className='data-repo'>
<h3>{repo.name}</h3>
<p>{repo.description}</p>
</div>
<div className='detail-repo'>
{
repo.topics.map((topic) =>
<p>#{topic}</p>)
}
</div>
<div className='description-repo'>
<div className='buttons'>
<button title='View repository'><a href={repo.html_url} target="_blank" rel="noreferrer"> <AiOutlineEye /> Repo</a></button>
<button title='Click view Demo'><a href={repo.homepage} target="_blank" rel="noreferrer"><TbHandClick /> Demo </a></button>
</div>
<p className='url_repo' style={{ display: "none" }}>{repo.clone_url}</p>
</div>
</div>
</Animated>
)
}
</div>
</div>
);
}
export default App;