This repository has been archived by the owner on Oct 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c65457
commit 6661796
Showing
7 changed files
with
107 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
08 - Integrando frontend e backend/gerenciador-tarefas-frontend/src/pages/HomePage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class HomePage extends Component { | ||
state = {} | ||
render() { | ||
return ( | ||
<div>Home</div> | ||
); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
08 - Integrando frontend e backend/gerenciador-tarefas-frontend/src/pages/SobrePage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React, { Component } from 'react'; | ||
|
||
export default class SobrePage extends Component { | ||
state = {} | ||
render() { | ||
return ( | ||
<div>Sobre</div> | ||
); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
08 - Integrando frontend e backend/gerenciador-tarefas-frontend/src/pages/TarefasPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import moment from 'moment'; | ||
import axios from 'axios'; | ||
import { Table, Switch, Button } from 'antd'; | ||
|
||
const { Column } = Table; | ||
|
||
export default class TarefasPage extends Component { | ||
|
||
state = { | ||
tarefas: [] | ||
} | ||
|
||
componentDidMount() { | ||
this.getTarefas(); | ||
} | ||
|
||
getTarefas = () => { | ||
axios.get('/tarefas') | ||
.then(response => { | ||
const { data } = response; | ||
this.setState({ | ||
tarefas: data | ||
}) | ||
}).catch(ex => { | ||
console.warn(ex); | ||
}) | ||
} | ||
|
||
render() { | ||
const { tarefas } = this.state; | ||
return ( | ||
<div> | ||
<Table dataSource={tarefas} > | ||
<Column | ||
key="id" | ||
title="#" | ||
dataIndex="id" | ||
render={(text) => ( | ||
<strong>{text}</strong> | ||
)} | ||
/> | ||
<Column | ||
key="titulo" | ||
title="Título" | ||
dataIndex="titulo" | ||
/> | ||
<Column | ||
key="createdAt" | ||
title="Data" | ||
dataIndex="createdAt" | ||
render={(text) => moment(text).format('DD/MM/YYYY [às] HH:mm')} | ||
/> | ||
<Column | ||
key="concluida" | ||
title="Concluída" | ||
dataIndex="concluida" | ||
render={(text) => ( | ||
<Switch checked={text} /> | ||
)} | ||
/> | ||
<Column | ||
key="acoes" | ||
title="Ações" | ||
render={() => ( | ||
<Button.Group size="small"> | ||
<Button icon="edit">Editar</Button> | ||
<Button type="danger" icon="delete">Excluir</Button> | ||
</Button.Group> | ||
)} | ||
/> | ||
</Table> | ||
</div> | ||
); | ||
} | ||
} |