Skip to content

Commit 2685d69

Browse files
committed
preparing to delete records
1 parent a27c914 commit 2685d69

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/pages/cadastro/Categoria/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ function CadastroCategoria() {
3838
});
3939
}, []);
4040

41+
function handleDelete(btn) {
42+
btn.target.closest('tr').remove();
43+
}
44+
4145
function listDescriptionAsList(description) {
4246
return (description.map((media) => (
4347
<li key={`${media}`}>
@@ -138,10 +142,17 @@ function CadastroCategoria() {
138142
</ul>
139143
</td>
140144
<td className="btnUD">
141-
<BtnUpDel style={{ background: 'blue' }}><i className="fas fa-edit" /></BtnUpDel>
145+
<BtnUpDel style={{ background: 'blue' }}>
146+
<i className="fas fa-edit" />
147+
</BtnUpDel>
142148
</td>
143149
<td className="btnUD">
144-
<BtnUpDel style={{ background: 'red', paddingRight: '12px', paddingLeft: '12px' }}><i className="fas fa-trash-alt" /></BtnUpDel>
150+
<BtnUpDel
151+
style={{ background: 'red', paddingRight: '12px', paddingLeft: '12px' }}
152+
onClick={handleDelete}
153+
>
154+
<i className="fas fa-trash-alt" />
155+
</BtnUpDel>
145156
</td>
146157
</tr>
147158
))}

0 commit comments

Comments
 (0)