Commit 6c279786 authored by Live Jortveit Sagebakken's avatar Live Jortveit Sagebakken
Browse files

(#3) Added filterCommits

parent d922639e
import React, { useState } from "react";
import commitView from "./commitView";
import commit from "./commit";
// Resource: https://reactjs.org/docs/forms.html
class filterCommits extends React.Component<{}, { value: string }>{
constructor(props: string) {
super(props);
this.state = {value: 'Alle commits'};
this.handleChange = this.handleChange.bind(this);
}
// Todo: Trenger å finne ut av hva slags type event er
// Bytte navn til filter-funksjon eller noe mer spesifikt
handleChange(event: any) {
this.setState({value: event.currentTarget.value});
alert("Filter on: " + event.currentTarget.value);
}
// Videre: Tror jeg må flytte alle commitsa hit fra commitView, eventuelt lage et interface eller noe (refactoring)
render(){
return (
<div>
<label>Filtrer commits:
<select value = {this.state.value} onChange = {this.handleChange}>
<option value="AllCommits">Alle commits</option>
<option value="lastSevenDays">Siste 7 dager</option>
<option value="lastFourteenDays">Siste 14 dager</option>
<option value="lastTwentyoneDays">Siste 21 dager</option>
<option value="lastThirtyDays">Siste 30 dager</option>
</select>
</label>
</div>
);
}
}
export default filterCommits;
\ No newline at end of file
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