Updated UserTabPanel UI

This commit is contained in:
Ruidy Nemausat 2020-04-17 10:09:31 +02:00
parent 6dea3bf41c
commit 19f896f296
8 changed files with 38 additions and 40 deletions

View file

@ -1,7 +1,10 @@
import React, { FC } from "react"; import React, { FC } from "react";
import { Header } from "../components/Header"; import { Header } from "../components/Header";
import { UserAvatar } from "./UserAvatar"; import { UserAvatar } from "./UserAvatar";
import { Grid, makeStyles, Theme } from "@material-ui/core"; import {
Grid,
// makeStyles, Theme
} from "@material-ui/core";
interface IProps { interface IProps {
fullName: string; fullName: string;
@ -9,25 +12,25 @@ interface IProps {
picture: string; picture: string;
} }
const useStyles = makeStyles((theme: Theme) => ({ // const useStyles = makeStyles((theme: Theme) => ({
root: { // root: {
margin: theme.spacing(1), // paddingTop: theme.spacing(2),
flexGrow: 1 // flexGrow: 1,
} // },
})); // }));
export const UserHeader: FC<IProps> = ({ fullName, presentation, picture }) => { export const UserHeader: FC<IProps> = ({ fullName, presentation, picture }) => {
const classes = useStyles(); // const classes = useStyles();
return ( return (
<div className={classes.root}> // <div className={classes.root}>
<Grid container> <Grid container>
<Grid item xs={2}> <Grid item xs={2}>
<UserAvatar picture={picture} alt="" /> <UserAvatar picture={picture} alt="" />
</Grid>
<Grid item xs>
<Header title={fullName} description={presentation} />
</Grid>
</Grid> </Grid>
</div> <Grid item xs>
<Header title={fullName} description={presentation} />
</Grid>
</Grid>
// </div>
); );
}; };

View file

@ -1,4 +1,4 @@
import React, { FC } from "react"; import React, { FC, useState, ReactNode } from "react";
import SwipeableViews from "react-swipeable-views"; import SwipeableViews from "react-swipeable-views";
import { makeStyles, Theme, useTheme } from "@material-ui/core/styles"; import { makeStyles, Theme, useTheme } from "@material-ui/core/styles";
import AppBar from "@material-ui/core/AppBar"; import AppBar from "@material-ui/core/AppBar";
@ -12,7 +12,7 @@ import { ProjectList } from "./ProjectList";
import { TicketList } from "./TicketList"; import { TicketList } from "./TicketList";
interface TabProps { interface TabProps {
children?: React.ReactNode; children?: ReactNode;
dir?: string; dir?: string;
index: any; index: any;
value: any; value: any;
@ -38,15 +38,15 @@ const TabPanel: FC<TabProps> = (props: TabProps) => {
const a11yProps = (index: any) => { const a11yProps = (index: any) => {
return { return {
id: `full-width-tab-${index}`, id: `full-width-tab-${index}`,
"aria-controls": `full-width-tabpanel-${index}` "aria-controls": `full-width-tabpanel-${index}`,
}; };
}; };
const useStyles = makeStyles((theme: Theme) => ({ const useStyles = makeStyles((theme: Theme) => ({
root: { root: {
backgroundColor: "#ffffff", backgroundColor: "#E9ECEF",
flexGrow: 1 borderRadius: "20px",
} },
})); }));
interface IProps { interface IProps {
@ -58,7 +58,7 @@ interface IProps {
export const UserTabPanel: FC<IProps> = ({ tickets, tabNames, projects }) => { export const UserTabPanel: FC<IProps> = ({ tickets, tabNames, projects }) => {
const classes = useStyles(); const classes = useStyles();
const theme = useTheme(); const theme = useTheme();
const [value, setValue] = React.useState(0); const [value, setValue] = useState(0);
const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => { const handleChange = (event: React.ChangeEvent<{}>, newValue: number) => {
setValue(newValue); setValue(newValue);
@ -70,14 +70,18 @@ export const UserTabPanel: FC<IProps> = ({ tickets, tabNames, projects }) => {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<AppBar position="static" color="inherit"> <AppBar
position="static"
color="inherit"
style={{ borderTopLeftRadius: "10px", borderTopRightRadius: "10px" }}
>
<Tabs <Tabs
value={value} value={value}
onChange={handleChange} onChange={handleChange}
indicatorColor="primary" indicatorColor="primary"
textColor="primary" textColor="primary"
variant="fullWidth" variant="fullWidth"
aria-label="full width tabs example" aria-label="full width tabs"
> >
{tabNames.map((t: string, i: number) => ( {tabNames.map((t: string, i: number) => (
<Tab key={i} label={t} {...a11yProps({ i })} /> <Tab key={i} label={t} {...a11yProps({ i })} />

View file

@ -13,6 +13,7 @@ const useStyles = makeStyles((theme) => ({
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
minHeight: "100vh", minHeight: "100vh",
backgroundColor: "#f8f9fa",
}, },
})); }));

View file

@ -8,8 +8,8 @@ const useStyles = makeStyles((theme: Theme) => ({
// root style allow for fixed footer // root style allow for fixed footer
header: { header: {
margin: theme.spacing(1), margin: theme.spacing(1),
marginTop: theme.spacing(2), paddingTop: theme.spacing(2),
marginBottom: theme.spacing(2), paddingBottom: theme.spacing(2),
flexGrow: 1, flexGrow: 1,
}, },
content: { content: {

View file

@ -1,5 +1,5 @@
import React, { FC, useState } from "react"; import React, { FC, useState } from "react";
import { Container, Grid, makeStyles, Theme } from "@material-ui/core"; import { Grid, makeStyles, Theme } from "@material-ui/core";
import { Header } from "../components/Header"; import { Header } from "../components/Header";
import { AvatarList } from "../components/AvatarList"; import { AvatarList } from "../components/AvatarList";
import { ProgressBar } from "../components/ProgressBar"; import { ProgressBar } from "../components/ProgressBar";

View file

@ -12,13 +12,7 @@ import { AvatarList } from "../components/AvatarList";
import { TicketVM } from "../VM/TicketVM"; import { TicketVM } from "../VM/TicketVM";
import { getRemainingdays } from "../utils/methods"; import { getRemainingdays } from "../utils/methods";
import { import { makeStyles, Theme, Grid, Typography } from "@material-ui/core";
Container,
makeStyles,
Theme,
Grid,
Typography,
} from "@material-ui/core";
import { Timer } from "@material-ui/icons"; import { Timer } from "@material-ui/icons";
import PageLayout from "../layouts/PageLayout"; import PageLayout from "../layouts/PageLayout";

View file

@ -2,7 +2,6 @@ import React, { FC } from "react";
import { UserVM } from "../VM/UserVM"; import { UserVM } from "../VM/UserVM";
import { UserHeader } from "../components/UserHeader"; import { UserHeader } from "../components/UserHeader";
import { UserTabPanel } from "../components/UserTabPanel"; import { UserTabPanel } from "../components/UserTabPanel";
import { Container } from "@material-ui/core";
import PageLayout from "../layouts/PageLayout"; import PageLayout from "../layouts/PageLayout";
interface IProps { interface IProps {

View file

@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { Route, Switch } from "react-router-dom"; import { Route, Switch } from "react-router-dom";
import { HomeController } from "../controllers/HomeController"; import { HomeController } from "../controllers/HomeController";
import { ProjectController } from "../controllers/ProjectController"; import { ProjectController } from "../controllers/ProjectController";
import { UserController } from "../controllers/UserController"; import { UserController } from "../controllers/UserController";
import { TicketController } from "../controllers/TicketController"; import { TicketController } from "../controllers/TicketController";
import { NotFoundPage } from "../pages/NotFoundPage"; import { NotFoundPage } from "../pages/NotFoundPage";
import { TestPage } from "../pages/TestPage";
import { PrivateRoute } from "./PrivateRoute";
export const AppRouter = () => { export const AppRouter = () => {
return ( return (