Commit 070d09da authored by Keith Charlene Tan Esmena's avatar Keith Charlene Tan Esmena
Browse files

Merge branch '1-make-issues-box'

parents 5165ec5e f0bad0ec
......@@ -41,7 +41,8 @@
font-weight: bold;
}
.commits {
.commits,
#issueBox {
width: 80vw;
margin: auto;
}
import React, { useEffect, useState } from "react";
import logo from "./logo.svg";
import "./App.css";
import IssueView from "./components/IssueView";
import CommitView from "./components/commitView";
function App() {
......@@ -12,14 +15,13 @@ function App() {
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<div className="App">
<header className="App-header">
<h1>Gitlab statistikk</h1>
</header>
<section>
<h3>Issues</h3>
<p>Legg inn det under her :)</p>
</section>
<IssueView />
<CommitView />
</div>
</>
......@@ -27,3 +29,6 @@ function App() {
}
export default App;
function componentDidMount() {
throw new Error("Function not implemented.");
}
import React, { Component, useEffect, useState } from "react";
class Issue extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.state = { issues: [] };
}
componentDidMount() {
let token = "3Nhst8cnMWx5puz8KEzR";
fetch("https://gitlab.stud.idi.ntnu.no/api/v4/projects/11882/issues", {
headers: {
Authorization: `Bearer ${token}`,
method: "GET",
},
})
.then((result) => result.json())
.then((issue) => this.setState({ issues: issue }));
}
render() {
return (
<div>
{this.state.issues.map(
(issue: { title: string; id: number }, index: React.Key) => (
<div key={index} className="panel panel-default">
<div className="panel-heading">{issue.title}</div>
<div className="panel-body">{issue.id}</div>
</div>
)
)}
</div>
);
}
}
export default Issue;
import React, { Component } from "react";
import Issue from "./Issue";
class IssueView extends React.Component<{}> {
render() {
return (
<>
<h3>Issues</h3>
<div id="issueBox">
{/* Må ha dette hvis Issue skal inni en IssueBox i App: {this.props.children} */}
<Issue></Issue>
</div>
</>
);
}
}
export default IssueView;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment