Skip to content

Commit

Permalink
Merge pull request #240 from mirumee/improve-mobile-appearance
Browse files Browse the repository at this point in the history
Improve mobile appearance
  • Loading branch information
maarcingebala authored Nov 20, 2019
2 parents 1e98cf1 + 5ce5ed0 commit 9b459f7
Show file tree
Hide file tree
Showing 70 changed files with 34,844 additions and 33,966 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Update customer's details page design - #248 by @dominik-zeglen
- Use Apollo Hooks - #254 by @dominik-zeglen
- Fix disappearing products description - #259 by @dominik-zeglen
- Improve mobile appearance - #240 by @benekex2 and @dominik-zeglen

## 2.0.0

Expand Down
6 changes: 3 additions & 3 deletions src/attributes/components/AttributeList/AttributeList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
Expand All @@ -8,6 +7,7 @@ import React from "react";
import { FormattedMessage, useIntl } from "react-intl";

import Checkbox from "@saleor/components/Checkbox";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import TableHead from "@saleor/components/TableHead";
import TablePagination from "@saleor/components/TablePagination";
Expand Down Expand Up @@ -75,7 +75,7 @@ const AttributeList: React.FC<AttributeListProps> = ({
const intl = useIntl();

return (
<Table>
<ResponsiveTable>
<TableHead
colSpan={numberOfColumns}
selected={selected}
Expand Down Expand Up @@ -207,7 +207,7 @@ const AttributeList: React.FC<AttributeListProps> = ({
)
)}
</TableBody>
</Table>
</ResponsiveTable>
);
};
AttributeList.displayName = "AttributeList";
Expand Down
6 changes: 3 additions & 3 deletions src/attributes/components/AttributeValues/AttributeValues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import IconButton from "@material-ui/core/IconButton";
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
Expand All @@ -11,6 +10,7 @@ import React from "react";
import { FormattedMessage, useIntl } from "react-intl";

import CardTitle from "@saleor/components/CardTitle";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import {
SortableTableBody,
Expand Down Expand Up @@ -80,7 +80,7 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
</Button>
}
/>
<Table>
<ResponsiveTable>
<TableHead>
<TableRow>
<TableCell className={classes.columnDrag} />
Expand Down Expand Up @@ -138,7 +138,7 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
)
)}
</SortableTableBody>
</Table>
</ResponsiveTable>
</Card>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/categories/components/CategoryList/CategoryList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
Expand All @@ -9,6 +8,7 @@ import { FormattedMessage } from "react-intl";

import { CategoryFragment } from "@saleor/categories/types/CategoryFragment";
import Checkbox from "@saleor/components/Checkbox";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import TableHead from "@saleor/components/TableHead";
import TablePagination from "@saleor/components/TablePagination";
Expand Down Expand Up @@ -73,7 +73,7 @@ const CategoryList: React.FC<CategoryListProps> = props => {
const classes = useStyles(props);

return (
<Table>
<ResponsiveTable>
<TableHead
colSpan={numberOfColumns}
selected={selected}
Expand Down Expand Up @@ -174,7 +174,7 @@ const CategoryList: React.FC<CategoryListProps> = props => {
)
)}
</TableBody>
</Table>
</ResponsiveTable>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
import TableRow from "@material-ui/core/TableRow";
import Checkbox from "@saleor/components/Checkbox";
import Money from "@saleor/components/Money";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import StatusLabel from "@saleor/components/StatusLabel";
import { FormattedMessage, useIntl } from "react-intl";
Expand Down Expand Up @@ -98,7 +98,7 @@ export const CategoryProductList: React.FC<

return (
<div className={classes.tableContainer}>
<Table className={classes.table}>
<ResponsiveTable className={classes.table}>
<colgroup>
<col />
<col className={classes.colName} />
Expand Down Expand Up @@ -229,7 +229,7 @@ export const CategoryProductList: React.FC<
)
)}
</TableBody>
</Table>
</ResponsiveTable>
</div>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/collections/components/CollectionList/CollectionList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
Expand All @@ -8,6 +7,7 @@ import React from "react";
import { FormattedMessage, useIntl } from "react-intl";

import Checkbox from "@saleor/components/Checkbox";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import StatusLabel from "@saleor/components/StatusLabel";
import TableHead from "@saleor/components/TableHead";
Expand Down Expand Up @@ -68,7 +68,7 @@ const CollectionList: React.FC<CollectionListProps> = props => {
const intl = useIntl();

return (
<Table>
<ResponsiveTable>
<TableHead
colSpan={numberOfColumns}
selected={selected}
Expand Down Expand Up @@ -174,7 +174,7 @@ const CollectionList: React.FC<CollectionListProps> = props => {
)
)}
</TableBody>
</Table>
</ResponsiveTable>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import IconButton from "@material-ui/core/IconButton";
import { makeStyles } from "@material-ui/core/styles";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableFooter from "@material-ui/core/TableFooter";
Expand All @@ -13,6 +12,7 @@ import { FormattedMessage, useIntl } from "react-intl";

import CardTitle from "@saleor/components/CardTitle";
import Checkbox from "@saleor/components/Checkbox";
import ResponsiveTable from "@saleor/components/ResponsiveTable";
import Skeleton from "@saleor/components/Skeleton";
import StatusLabel from "@saleor/components/StatusLabel";
import TableCellAvatar, {
Expand Down Expand Up @@ -114,7 +114,7 @@ const CollectionProducts: React.FC<CollectionProductsProps> = props => {
</Button>
}
/>
<Table className={classes.table}>
<ResponsiveTable className={classes.table}>
<TableHead
colSpan={numberOfColumns}
selected={selected}
Expand Down Expand Up @@ -232,7 +232,7 @@ const CollectionProducts: React.FC<CollectionProductsProps> = props => {
)
)}
</TableBody>
</Table>
</ResponsiveTable>
</Card>
);
};
Expand Down
11 changes: 9 additions & 2 deletions src/components/AppHeader/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const useStyles = makeStyles(theme => ({
cursor: "pointer",
display: "flex",
marginTop: theme.spacing(0.5),
transition: theme.transitions.duration.standard + "ms"
transition: theme.transitions.duration.standard + "ms",
[theme.breakpoints.down("sm")]: {
display: "none"
}
},
skeleton: {
marginBottom: theme.spacing(2),
Expand All @@ -40,9 +43,13 @@ const useStyles = makeStyles(theme => ({
color: "inherit",
flex: 1,
marginLeft: theme.spacing(),
textTransform: "uppercase"
textTransform: "uppercase",
[theme.breakpoints.down("sm")]: {
display: "none"
}
}
}));

const AppHeader: React.FC<AppHeaderProps> = props => {
const { children, onBack } = props;

Expand Down
30 changes: 28 additions & 2 deletions src/components/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ const useStyles = makeStyles(
marginLeft: theme.spacing(2),
transition: theme.transitions.duration.standard + "ms"
},
avatar: {
"&&": {
height: 32,
width: 32
}
},
content: {
[theme.breakpoints.down("sm")]: {
paddingLeft: 0
Expand All @@ -79,9 +85,16 @@ const useStyles = makeStyles(
paddingLeft: drawerWidth
},
darkThemeSwitch: {
[theme.breakpoints.down("sm")]: {
marginRight: -theme.spacing(1.5)
},
marginRight: theme.spacing(2)
},
header: {
[theme.breakpoints.down("sm")]: {
height: 88,
marginBottom: 0
},
display: "flex",
height: 40,
marginBottom: theme.spacing(3)
Expand Down Expand Up @@ -179,6 +192,9 @@ const useStyles = makeStyles(
[theme.breakpoints.up("md")]: {
display: "none"
},
[theme.breakpoints.down("sm")]: {
left: 0
},
background: theme.palette.background.paper,
borderRadius: "50%",
cursor: "pointer",
Expand Down Expand Up @@ -239,12 +255,20 @@ const useStyles = makeStyles(
flex: 1
},
userBar: {
[theme.breakpoints.down("sm")]: {
alignItems: "flex-end",
flexDirection: "column-reverse",
overflow: "hidden"
},
alignItems: "center",
display: "flex"
},
userChip: {
backgroundColor: theme.palette.background.paper,
color: theme.palette.text.primary
borderRadius: 24,
color: theme.palette.text.primary,
height: 40,
padding: theme.spacing(0.5)
},
userMenuContainer: {
position: "relative"
Expand Down Expand Up @@ -415,6 +439,9 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
<Avatar alt="user" src={user.avatar.url} />
)
}
classes={{
avatar: classes.avatar
}}
className={classes.userChip}
label={
<>
Expand All @@ -433,7 +460,6 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
open={isMenuOpened}
anchorEl={anchor.current}
transition
disablePortal
placement="bottom-end"
>
{({ TransitionProps, placement }) => (
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppLayout/MenuList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const useStyles = makeStyles(theme => ({
content: "''",
height: 0,
position: "absolute",
right: -35,
right: -30,
top: 15,
width: 0
},
Expand Down
13 changes: 7 additions & 6 deletions src/components/AppLayout/MenuNested.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SVG from "react-inlinesvg";
import menuArrowIcon from "@assets/images/menu-arrow-icon.svg";
import useTheme from "@saleor/hooks/useTheme";
import { createHref } from "@saleor/misc";
import { drawerWidthExpanded } from "./consts";
import { drawerNestedMenuWidth, drawerWidthExpandedMobile } from "./consts";
import { IActiveSubMenu } from "./MenuList";
import { IMenuItem } from "./menuStructure";

Expand All @@ -20,15 +20,15 @@ const useStyles = makeStyles(theme => ({
right: 0,
top: 0,
transition: `right ${theme.transitions.duration.shorter}ms ease`,
width: 300,
width: drawerNestedMenuWidth,
zIndex: -1
},
menuListNestedClose: {
"& svg": {
fill: theme.palette.primary.main,
left: 7,
left: 11,
position: "relative",
top: -2
top: 1
},
border: `solid 1px #EAEAEA`,
borderRadius: "100%",
Expand Down Expand Up @@ -71,10 +71,11 @@ const useStyles = makeStyles(theme => ({
menuListNestedOpen: {
[theme.breakpoints.down("sm")]: {
right: 0,
width: drawerWidthExpanded,
width: drawerWidthExpandedMobile,
zIndex: 2
},
right: -300,
right: -drawerNestedMenuWidth,
width: drawerNestedMenuWidth,
zIndex: -1
},
subHeader: {
Expand Down
8 changes: 6 additions & 2 deletions src/components/AppLayout/ResponsiveDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import Drawer from "@material-ui/core/Drawer";
import Hidden from "@material-ui/core/Hidden";
import { makeStyles } from "@material-ui/core/styles";
import React from "react";
import { drawerWidth, drawerWidthExpanded } from "./consts";
import {
drawerWidth,
drawerWidthExpanded,
drawerWidthExpandedMobile
} from "./consts";

const useStyles = makeStyles(
theme => ({
Expand All @@ -22,7 +26,7 @@ const useStyles = makeStyles(
width: drawerWidth
},
drawerMobile: {
width: drawerWidthExpanded
width: drawerWidthExpandedMobile
}
}),
{ name: "ResponsiveDrawer" }
Expand Down
2 changes: 2 additions & 0 deletions src/components/AppLayout/consts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const drawerWidthExpanded = 210;
export const drawerWidthExpandedMobile = 250;
export const drawerWidth = 80;
export const drawerNestedMenuWidth = 300;
export const navigationBarHeight = 64;
export const appLoaderHeight = 4;
Loading

0 comments on commit 9b459f7

Please sign in to comment.