improvement: better on table row skeleton styles

This commit is contained in:
canove
2020-11-13 07:12:27 -03:00
parent 43a17ba999
commit 9e82c5cc1f
3 changed files with 39 additions and 16 deletions

View File

@@ -11,7 +11,6 @@ import Avatar from "@material-ui/core/Avatar";
import Button from "@material-ui/core/Button"; import Button from "@material-ui/core/Button";
import Paper from "@material-ui/core/Paper"; import Paper from "@material-ui/core/Paper";
import { i18n } from "../../translate/i18n"; import { i18n } from "../../translate/i18n";
import LinkifyWithTargetBlank from "../LinkifyWithTargetBlank"; import LinkifyWithTargetBlank from "../LinkifyWithTargetBlank";
import ContactModal from "../ContactModal"; import ContactModal from "../ContactModal";
@@ -19,8 +18,6 @@ import ContactDrawerSkeleton from "../ContactDrawerSkeleton";
const drawerWidth = 320; const drawerWidth = 320;
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(theme => ({
drawer: { drawer: {
width: drawerWidth, width: drawerWidth,
@@ -151,7 +148,6 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, loading }) => {
variant="outlined" variant="outlined"
className={classes.contactExtraInfo} className={classes.contactExtraInfo}
> >
<InputLabel>{info.name}</InputLabel> <InputLabel>{info.name}</InputLabel>
<LinkifyWithTargetBlank> <LinkifyWithTargetBlank>
<Typography noWrap style={{ paddingTop: 2 }}> <Typography noWrap style={{ paddingTop: 2 }}>

View File

@@ -2,8 +2,18 @@ import React from "react";
import TableCell from "@material-ui/core/TableCell"; import TableCell from "@material-ui/core/TableCell";
import TableRow from "@material-ui/core/TableRow"; import TableRow from "@material-ui/core/TableRow";
import Skeleton from "@material-ui/lab/Skeleton"; import Skeleton from "@material-ui/lab/Skeleton";
import { makeStyles } from "@material-ui/core";
const useStyles = makeStyles(theme => ({
customTableCell: {
display: "flex",
alignItems: "center",
justifyContent: "center",
},
}));
const TableRowSkeleton = () => { const TableRowSkeleton = () => {
const classes = useStyles();
return ( return (
<> <>
<TableRow> <TableRow>
@@ -13,13 +23,21 @@ const TableRowSkeleton = () => {
<TableCell> <TableCell>
<Skeleton animation="wave" height={20} width={80} /> <Skeleton animation="wave" height={20} width={80} />
</TableCell> </TableCell>
<TableCell> <TableCell align="center">
<Skeleton animation="wave" height={20} width={80} /> <div className={classes.customTableCell}>
<Skeleton align="center" animation="wave" height={20} width={80} />
</div>
</TableCell> </TableCell>
<TableCell> <TableCell align="center">
<Skeleton animation="wave" height={20} width={80} /> <div className={classes.customTableCell}>
<Skeleton align="center" animation="wave" height={20} width={80} />
</div>
</TableCell>
<TableCell align="center">
<div className={classes.customTableCell}>
<Skeleton align="center" animation="wave" height={20} width={80} />
</div>
</TableCell> </TableCell>
<TableCell></TableCell>
</TableRow> </TableRow>
</> </>
); );

View File

@@ -28,6 +28,7 @@ import { i18n } from "../../translate/i18n";
import TableRowSkeleton from "../../components/TableRowSkeleton"; import TableRowSkeleton from "../../components/TableRowSkeleton";
import UserModal from "../../components/UserModal"; import UserModal from "../../components/UserModal";
import ConfirmationModal from "../../components/ConfirmationModal"; import ConfirmationModal from "../../components/ConfirmationModal";
import { Avatar } from "@material-ui/core";
const reducer = (state, action) => { const reducer = (state, action) => {
if (action.type === "LOAD_USERS") { if (action.type === "LOAD_USERS") {
@@ -110,7 +111,7 @@ const Users = () => {
}); });
dispatch({ type: "LOAD_USERS", payload: data.users }); dispatch({ type: "LOAD_USERS", payload: data.users });
setHasMore(data.hasMore); setHasMore(data.hasMore);
setLoading(false); // setLoading(false);
} catch (err) { } catch (err) {
const errorMsg = err.response?.data?.error; const errorMsg = err.response?.data?.error;
if (errorMsg) { if (errorMsg) {
@@ -252,10 +253,15 @@ const Users = () => {
<Table size="small"> <Table size="small">
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell padding="checkbox" />
<TableCell>{i18n.t("users.table.name")}</TableCell> <TableCell>{i18n.t("users.table.name")}</TableCell>
<TableCell>{i18n.t("users.table.email")}</TableCell> <TableCell align="center">
<TableCell>{i18n.t("users.table.profile")}</TableCell> {i18n.t("users.table.email")}
<TableCell align="right"> </TableCell>
<TableCell align="center">
{i18n.t("users.table.profile")}
</TableCell>
<TableCell align="center">
{i18n.t("users.table.actions")} {i18n.t("users.table.actions")}
</TableCell> </TableCell>
</TableRow> </TableRow>
@@ -264,10 +270,13 @@ const Users = () => {
<> <>
{users.map(user => ( {users.map(user => (
<TableRow key={user.id}> <TableRow key={user.id}>
<TableCell style={{ paddingRight: 0 }}>
{<Avatar />}
</TableCell>
<TableCell>{user.name}</TableCell> <TableCell>{user.name}</TableCell>
<TableCell>{user.email}</TableCell> <TableCell align="center">{user.email}</TableCell>
<TableCell>{user.profile}</TableCell> <TableCell align="center">{user.profile}</TableCell>
<TableCell align="right"> <TableCell align="center">
<IconButton <IconButton
size="small" size="small"
onClick={() => handleEditUser(user)} onClick={() => handleEditUser(user)}