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
50bfbd9
commit 13d6f70
Showing
5 changed files
with
62 additions
and
101 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
31 changes: 0 additions & 31 deletions
31
...ntegrando frontend e backend/gerenciador-de-tarefas-completo/src/components/TarefaItem.js
This file was deleted.
Oops, something went wrong.
73 changes: 46 additions & 27 deletions
73
...egrando frontend e backend/gerenciador-de-tarefas-completo/src/components/TarefasTable.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 |
---|---|---|
@@ -1,38 +1,57 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import { Table, } from 'reactstrap'; | ||
import moment from 'moment'; | ||
import { Table, Button, Switch } from 'antd'; | ||
|
||
import TarefaItem from './TarefaItem'; | ||
const { Column } = Table; | ||
|
||
export default class TarefasTable extends Component { | ||
|
||
renderTarefa = (tarefa, index) => { | ||
return ( | ||
<TarefaItem key={tarefa.id} tarefa={tarefa} {...this.props} /> | ||
) | ||
} | ||
|
||
renderTarefas = () => { | ||
const { tarefas } = this.props; | ||
return tarefas.map(this.renderTarefa); | ||
} | ||
|
||
render() { | ||
const { onConcluidaChange, onExcluirClick, onEditarClick } = this.props; | ||
|
||
return ( | ||
<Table striped> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>Título</th> | ||
<th>Criada em</th> | ||
<th>Concluída</th> | ||
<th>Opções</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{this.renderTarefas()} | ||
</tbody> | ||
<Table rowKey={tarefa => tarefa.id} dataSource={this.props.tarefas} pagination={false} > | ||
<Column | ||
title='#' | ||
dataIndex='id' | ||
key='id' | ||
/> | ||
<Column | ||
title='Título' | ||
dataIndex='titulo' | ||
key='titulo' | ||
/> | ||
<Column | ||
title='Criado em' | ||
dataIndex='createdAt' | ||
key='createdAt' | ||
render={(text, tarefa) => ( | ||
<span> | ||
{moment(tarefa.createdAt).format('DD/MM/YYYY')} | ||
</span> | ||
)} | ||
/> | ||
<Column | ||
title='Concluída' | ||
dataIndex='concluida' | ||
key='concluida' | ||
render={(text, tarefa) => ( | ||
<Switch checked={tarefa.concluida} | ||
onChange={checked => onConcluidaChange(tarefa.id, checked)} /> | ||
)} | ||
/> | ||
<Column | ||
title='Opções' | ||
key='opcoes' | ||
render={(text, tarefa) => ( | ||
<Button.Group size="small"> | ||
<Button type="ghost" onClick={() => onEditarClick(tarefa.id)}>Editar</Button> | ||
<Button type="danger" onClick={() => onExcluirClick(tarefa.id)}>Excluir</Button> | ||
</Button.Group> | ||
)} | ||
/> | ||
</Table> | ||
); | ||
} | ||
} | ||
} |
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