Skip to content

Commit 6dc9d60

Browse files
authored
Merge pull request #3 from Lemoncode/feature/Create_Dashboard
Create Dashboard
2 parents 0b1bd22 + 8dd5fb6 commit 6dc9d60

4 files changed

Lines changed: 36 additions & 32 deletions

File tree

src/pods/submodule-list/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './submodule-list.component';
1+
export * from './submodule-list.container';
Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,11 @@
11
import React from 'react';
2-
import { useHistory } from 'react-router-dom';
3-
import { routes } from 'core/router';
2+
import { DashboardComponent, DashboardItemProps } from 'common/components';
43

5-
export const SumoduleListComponent: React.FunctionComponent = () => {
6-
const history = useHistory();
7-
const goToProjectList = (
8-
event: React.MouseEvent<HTMLParagraphElement, MouseEvent>
9-
) => {
10-
event.preventDefault();
11-
history.push({
12-
pathname: routes.projects,
13-
});
14-
};
4+
interface Props {
5+
items: DashboardItemProps[];
6+
}
157

16-
const goToEmployeeList = (
17-
event: React.MouseEvent<HTMLParagraphElement, MouseEvent>
18-
) => {
19-
event.preventDefault();
20-
history.push({
21-
pathname: routes.employees,
22-
});
23-
};
24-
25-
return (
26-
// Pending to use dashboard component
27-
<>
28-
<h1>Hello Submodule List</h1>
29-
<p onClick={goToProjectList}>Go to Project list page</p>
30-
<p onClick={goToEmployeeList}>Go to Employee list page</p>
31-
</>
32-
);
8+
export const SumoduleListComponent: React.FunctionComponent<Props> = props => {
9+
const { items } = props;
10+
return <DashboardComponent items={items} />;
3311
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import React from 'react';
2+
import { SumoduleListComponent } from './submodule-list.component';
3+
import { DashboardItemProps } from 'common/components';
4+
import { routes } from 'core/router';
5+
import AccountBalanceIcon from '@material-ui/icons/AccountBalance';
6+
import GroupIcon from '@material-ui/icons/Group';
7+
8+
export const SubmoduleListContainer: React.FunctionComponent = () => {
9+
const items: DashboardItemProps[] = React.useMemo(
10+
(): DashboardItemProps[] => [
11+
{
12+
title: 'Proyectos',
13+
linkTo: routes.projects,
14+
icon: AccountBalanceIcon,
15+
},
16+
{
17+
title: 'Empleados',
18+
linkTo: routes.employees,
19+
icon: GroupIcon,
20+
},
21+
],
22+
[]
23+
);
24+
25+
return <SumoduleListComponent items={items} />;
26+
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
22
import { AppLayout } from 'layouts';
3-
import { SumoduleListComponent } from 'pods/submodule-list';
3+
import { SubmoduleListContainer } from 'pods/submodule-list';
44

55
export const SubmoduleListScene: React.FC = () => {
66
return (
77
<AppLayout>
8-
<SumoduleListComponent />
8+
<SubmoduleListContainer />
99
</AppLayout>
1010
);
1111
};

0 commit comments

Comments
 (0)