diff --git a/client/src/layouts/PageLayout.tsx b/client/src/layouts/PageLayout.tsx new file mode 100644 index 0000000..eee403a --- /dev/null +++ b/client/src/layouts/PageLayout.tsx @@ -0,0 +1,43 @@ +import React, { FC, ReactNode } from "react"; +import { makeStyles, Theme, Container } from "@material-ui/core"; + +/** + * @function useStyles creates the css styles used in the following component. + */ +const useStyles = makeStyles((theme: Theme) => ({ + // root style allow for fixed footer + header: { + margin: theme.spacing(1), + marginTop: theme.spacing(2), + marginBottom: theme.spacing(2), + flexGrow: 1, + }, + content: { + margin: theme.spacing(1), + marginTop: theme.spacing(2), + marginBottom: theme.spacing(2), + }, +})); + +interface IProps { + header: ReactNode; + content: ReactNode; +} + +/** + * PageLayout divide the page in 2 parts: Header and Content, to ensure cohesion. + * + * @param Header - The encapsulated component. + * @param Content - The encapsulated component. + */ +const PageLayout: FC = ({ header, content }) => { + const classes = useStyles(); + return ( + +
{header}
+
{content}
+
+ ); +}; + +export default PageLayout; diff --git a/client/src/pages/NotFoundPage.tsx b/client/src/pages/NotFoundPage.tsx index a13397c..5b60c5e 100644 --- a/client/src/pages/NotFoundPage.tsx +++ b/client/src/pages/NotFoundPage.tsx @@ -1,10 +1,13 @@ import React, { FC } from "react"; +import PageLayout from "../layouts/PageLayout"; +import { Header } from "../components/Header"; interface IProps {} export const NotFoundPage: FC = () => { return ( -
-

error

-
+ } + content={

error

} + /> ); }; diff --git a/client/src/pages/ProjectPage.tsx b/client/src/pages/ProjectPage.tsx index 6f09d7b..d43d0f6 100644 --- a/client/src/pages/ProjectPage.tsx +++ b/client/src/pages/ProjectPage.tsx @@ -1,12 +1,13 @@ import React, { FC, useState } from "react"; -import ProjectVM from "../VM/ProjectVM"; +import { Container, Grid, makeStyles, Theme } from "@material-ui/core"; import { Header } from "../components/Header"; import { AvatarList } from "../components/AvatarList"; import { ProgressBar } from "../components/ProgressBar"; import { FloatingButton } from "../components/FloatingButton"; import { UsersModal } from "../components/UsersModal"; -import { Container, Grid, makeStyles, Theme } from "@material-ui/core"; import { ProjectTabPanel } from "../components/ProjectTabPanel"; +import ProjectVM from "../VM/ProjectVM"; +import PageLayout from "../layouts/PageLayout"; interface IProps { viewModel: ProjectVM; @@ -15,8 +16,8 @@ interface IProps { const useStyles = makeStyles((theme: Theme) => ({ root: { margin: theme.spacing(1), - flexGrow: 1 - } + flexGrow: 1, + }, })); export const ProjectPage: FC = ({ viewModel }) => { @@ -33,7 +34,7 @@ export const ProjectPage: FC = ({ viewModel }) => { remainingDays, files, // activities, - allProjects + allProjects, } = viewModel; const tabNames: string[] = ["Tickets", "Files"]; //, "Activity"]; @@ -41,47 +42,53 @@ export const ProjectPage: FC = ({ viewModel }) => { const classes = useStyles(); - return ( - -
-
-
- setShowModal(false)} - /> - - - - - - - setShowModal(true)} - /> - - - -
- { + return ( + <> + setShowModal(false)} /> -
- -
+ + + + + + + setShowModal(true)} + /> + + + +
+ +
+ + + ); + }; + + return ( + } + content={} + /> ); }; diff --git a/client/src/pages/TicketPage.tsx b/client/src/pages/TicketPage.tsx index 7788dd2..2f4592d 100644 --- a/client/src/pages/TicketPage.tsx +++ b/client/src/pages/TicketPage.tsx @@ -17,9 +17,10 @@ import { makeStyles, Theme, Grid, - Typography + Typography, } from "@material-ui/core"; import { Timer } from "@material-ui/icons"; +import PageLayout from "../layouts/PageLayout"; interface IProps { viewModel: TicketVM; @@ -28,11 +29,11 @@ interface IProps { const useStyles = makeStyles((theme: Theme) => ({ root: { margin: theme.spacing(1), - flexGrow: 1 + flexGrow: 1, }, table: { - minWidth: 650 - } + minWidth: 650, + }, })); export const TicketPage: FC = ({ viewModel }) => { @@ -45,50 +46,55 @@ export const TicketPage: FC = ({ viewModel }) => { status, category, impact, - difficulty + difficulty, } = viewModel; const daysToEnd: number = getRemainingdays(endingDate); // let notes: string = ""; const classes = useStyles(); + const Content: FC = () => { + return ( + <> + + +
+ + + + In project: {" "} + {project.title} + + + + Due in {daysToEnd} days + + +
+ +
+ + {/* */} +
+ + ); + }; return ( - -
-
-
- - -
- - - - In project: {" "} - {project.title} - - - - Due in {daysToEnd} days - - -
- -
- - {/* */} -
-
+ } + content={} + /> ); }; diff --git a/client/src/pages/UserPage.tsx b/client/src/pages/UserPage.tsx index 6e4f9e4..0d0f3a9 100644 --- a/client/src/pages/UserPage.tsx +++ b/client/src/pages/UserPage.tsx @@ -3,6 +3,7 @@ import { UserVM } from "../VM/UserVM"; import { UserHeader } from "../components/UserHeader"; import { UserTabPanel } from "../components/UserTabPanel"; import { Container } from "@material-ui/core"; +import PageLayout from "../layouts/PageLayout"; interface IProps { viewModel: UserVM; @@ -13,13 +14,21 @@ export const UserPage: FC = ({ viewModel }) => { const tabNames: string[] = ["Projects", "Tickets"]; return ( - - - - + + } + content={ + + } + /> ); };