Skip to content

Commit 524dea7

Browse files
author
Antonio Contreras LEMONCODE
committed
Fix components
1 parent 70b0420 commit 524dea7

2 files changed

Lines changed: 32 additions & 39 deletions

File tree

src/pods/employee-list/components/employee-row.component.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ import {
44
RowComponent,
55
CellComponent,
66
} from 'common/components';
7-
import { Employee } from '../employee-list.vm';
87
import IconButton from '@material-ui/core/IconButton';
98
import EditIcon from '@material-ui/icons/Edit';
109
import DeleteIcon from '@material-ui/icons/Delete';
10+
import { Employee } from '../employee-list.vm';
1111

1212
type Props = RowRendererProps<Employee>;
1313

14-
export const EmployeeRowComponent: React.FunctionComponent<Props> = ({
15-
row,
16-
onEdit,
17-
onDelete,
18-
}) => {
14+
export const EmployeeRowComponent: React.FunctionComponent<Props> = props => {
15+
const { row, onEdit, onDelete } = props;
16+
1917
return (
2018
<RowComponent>
2119
<CellComponent>{row.active}</CellComponent>

src/pods/employee-list/employee-list.component.tsx

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,43 @@ interface Props {
1414
onDelete: (id: string) => void;
1515
}
1616

17-
export const EmployeeListComponent: React.FunctionComponent<Props> = ({
18-
employeeList,
19-
onCreate,
20-
onEdit,
21-
onDelete,
22-
}) => {
17+
export const EmployeeListComponent: React.FunctionComponent<Props> = props => {
18+
const { employeeList, onCreate, onEdit, onDelete } = props;
2319
const { filteredList, onSearch, search } = useSearchBar(employeeList, [
2420
'name',
2521
]);
2622

2723
const renderContent = ({ itemName }) => {
2824
return (
29-
<div>
25+
<>
3026
¿Seguro que quiere borrar a <strong>{itemName}</strong>?
31-
</div>
27+
</>
3228
);
3329
};
30+
3431
return (
35-
<>
36-
<TableContainer
37-
columns={['Activo', 'Id', 'Nombre', 'Email', 'Fecha último incurrido']}
38-
rows={filteredList}
39-
rowRenderer={(rowProps: RowRendererProps<Employee>) => (
40-
<EmployeeRowComponent {...rowProps} />
41-
)}
42-
onCreate={onCreate}
43-
onEdit={onEdit}
44-
onDelete={onDelete}
45-
labels={{
46-
searchPlaceholder: 'Buscar empleado',
47-
createButton: 'Nuevo empleado',
48-
deleteTitle: 'Eliminar Empleado',
49-
deleteContent: props => renderContent(props),
50-
closeButton: 'Cancelar',
51-
acceptButton: 'Aceptar',
52-
}}
53-
enableSearch={true}
54-
search={search}
55-
onSearch={onSearch}
56-
enablePagination={true}
57-
pageSize={5}
58-
/>
59-
</>
32+
<TableContainer
33+
columns={['Activo', 'Id', 'Nombre', 'Email', 'Fecha último incurrido']}
34+
rows={filteredList}
35+
rowRenderer={(rowProps: RowRendererProps<Employee>) => (
36+
<EmployeeRowComponent {...rowProps} />
37+
)}
38+
onCreate={onCreate}
39+
onEdit={onEdit}
40+
onDelete={onDelete}
41+
labels={{
42+
searchPlaceholder: 'Buscar empleado',
43+
createButton: 'Nuevo empleado',
44+
deleteTitle: 'Eliminar Empleado',
45+
deleteContent: props => renderContent(props),
46+
closeButton: 'Cancelar',
47+
acceptButton: 'Aceptar',
48+
}}
49+
enableSearch={true}
50+
search={search}
51+
onSearch={onSearch}
52+
enablePagination={true}
53+
pageSize={5}
54+
/>
6055
);
6156
};

0 commit comments

Comments
 (0)