Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add mobile styles
Krzysztof Bialoglowicze9e855b583db
diff --git a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsxindex 3dc74d0e86..97a995e68b 100644--- a/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx+++ b/saleor/static/dashboard-next/components/AppLayout/AppLayout.tsx@@ -1,6 +1,7 @@import Chip from "@material-ui/core/Chip";import ClickAwayListener from "@material-ui/core/ClickAwayListener";import Grow from "@material-ui/core/Grow";+import Hidden from "@material-ui/core/Hidden";import LinearProgress from "@material-ui/core/LinearProgress";import MenuItem from "@material-ui/core/MenuItem";import Menu from "@material-ui/core/MenuList";@@ -313,14 +314,16 @@ const AppLayout = withStyles(styles, {}/></div>- <div- className={classNames(classes.menuToggle, {- [classes.menuToggleHide]: menuToggle- })}- onClick={handleMenuToggle}- >- <SVG src={menuArrowIcon} />- </div>+ <Hidden smDown>+ <div+ className={classNames(classes.menuToggle, {+ [classes.menuToggleHide]: menuToggle+ })}+ onClick={handleMenuToggle}+ >+ <SVG src={menuArrowIcon} />+ </div>+ </Hidden><MenuListclassName={menuToggle ? classes.menuSmall : classes.menudiff --git a/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx b/saleor/static/dashboard-next/components/AppLayout/MenuList.tsxindex 3ad3a08b97..fc1e200c33 100644--- a/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx+++ b/saleor/static/dashboard-next/components/AppLayout/MenuList.tsx@@ -38,15 +38,7 @@ const styles = (theme: Theme) =>fill: theme.palette.common.white}},- menuList: {- display: "flex",- flexDirection: "column",- height: "100%",- marginLeft: theme.spacing.unit * 4,- marginTop: theme.spacing.unit * 2,- paddingBottom: theme.spacing.unit * 3- },- menuListItem: {+ menuItemHover: {"& path": {transition: "fill 0.5s ease"},@@ -56,8 +48,18 @@ const styles = (theme: Theme) =>},color: theme.palette.primary.main},+ cursor: "pointer"+ },+ menuList: {+ display: "flex",+ flexDirection: "column",+ height: "100%",+ marginLeft: theme.spacing.unit * 4,+ marginTop: theme.spacing.unit * 2,+ paddingBottom: theme.spacing.unit * 3+ },+ menuListItem: {alignItems: "center",- cursor: "pointer",display: "block",marginTop: theme.spacing.unit * 2,paddingLeft: 0,@@ -92,9 +94,14 @@ const styles = (theme: Theme) =>display: "inline-block",fontSize: "1rem",fontWeight: 500,+ opacity: 1,paddingLeft: 16,textTransform: "uppercase",- transition: theme.transitions.duration.standard + "ms"+ transition: "opacity 0.2s ease"+ },+ menuListItemTextHide: {+ opacity: 0,+ transition: "opacity 0.2s ease"},menuListNested: {"& $menuListItemActive": {@@ -114,9 +121,40 @@ const styles = (theme: Theme) =>width: 300,zIndex: -1},+ menuListNestedClose: {+ "& svg": {+ fill: theme.palette.primary.main,+ left: 7,+ position: "relative",+ top: -2+ },+ border: `solid 1px #EAEAEA`,+ borderRadius: "100%",+ cursor: "pointer",+ height: 32,+ position: "absolute",+ right: 32,+ top: 35,+ transform: "rotate(180deg)",+ width: 32+ },+ menuListNestedCloseDark: {+ border: `solid 1px #252728`+ },menuListNestedHide: {opacity: 0},+ menuListNestedIcon: {+ "& path": {+ fill: "initial"+ },+ "& svg": { height: 32, position: "relative", top: 7, width: 32 }+ },+ menuListNestedIconDark: {+ "& path": {+ fill: theme.palette.common.white+ }+ },menuListNestedItem: {"&:hover": {"& p": {@@ -128,9 +166,29 @@ const styles = (theme: Theme) =>textDecoration: "none"},menuListNestedOpen: {+ [theme.breakpoints.down("sm")]: {+ right: 0,+ width: drawerWidth,+ zIndex: 2+ },right: -300,zIndex: -1},+ subHeader: {+ borderBottom: "solid 1px #EAEAEA",+ margin: "30px",+ paddingBottom: 20+ },+ subHeaderDark: {+ borderBottom: "solid 1px #252728"+ },+ subHeaderTitle: {+ [theme.breakpoints.up("md")]: {+ paddingLeft: 0+ },+ display: "inline",+ paddingLeft: 10+ },subMenu: {padding: "0 15px"},@@ -155,11 +213,6 @@ const styles = (theme: Theme) =>subMenuDrawerSmall: {left: drawerWidthSmall,width: `calc(100vw - ${drawerWidthSmall})px`- },- subheader: {- borderBottom: "solid 1px #EAEAEA",- margin: "30px",- paddingBottom: 20}});@@ -250,21 +303,24 @@ const MenuList = withStyles(styles, { name: "MenuList" })([classes.menuListItemActive]: isAnyChildActive})}>- <div onClick={() => handleSubMenu(menuItem.ariaLabel)}>+ <div+ className={classes.menuItemHover}+ onClick={() => handleSubMenu(menuItem.ariaLabel)}+ ><SVGclassName={classNames(classes.menuIcon, {[classes.menuIconDark]: isDark})}src={menuItem.icon}/>- {menuToggle && (- <Typography- aria-label={menuItem.ariaLabel}- className={classes.menuListItemText}- >- {menuItem.label}- </Typography>- )}+ <Typography+ aria-label={menuItem.ariaLabel}+ className={classNames(classes.menuListItemText, {+ [classes.menuListItemTextHide]: !menuToggle+ })}+ >+ {menuItem.label}+ </Typography></div><MenuNestedactiveItem={activeSubMenu}@@ -274,6 +330,7 @@ const MenuList = withStyles(styles, { name: "MenuList" })(onMenuItemClick={onMenuItemClick}handleSubMenu={handleSubMenu}title={menuItem.label}+ icon={menuItem.icon}ariaLabel={menuItem.ariaLabel}/><div@@ -297,20 +354,22 @@ const MenuList = withStyles(styles, { name: "MenuList" })(onClick={event => closeSubMenu(menuItem.url, event)}key={menuItem.label}>- <SVG- className={classNames(classes.menuIcon, {- [classes.menuIconDark]: isDark- })}- src={menuItem.icon}- />- {menuToggle && (+ <div className={classes.menuItemHover}>+ <SVG+ className={classNames(classes.menuIcon, {+ [classes.menuIconDark]: isDark+ })}+ src={menuItem.icon}+ /><Typographyaria-label={menuItem.ariaLabel}- className={classes.menuListItemText}+ className={classNames(classes.menuListItemText, {+ [classes.menuListItemTextHide]: !menuToggle+ })}>{menuItem.label}</Typography>- )}+ </div></a>);})}@@ -327,20 +386,22 @@ const MenuList = withStyles(styles, { name: "MenuList" })(href={createHref(configurationMenuUrl)}onClick={event => onMenuItemClick(configurationMenuUrl, event)}>- <SVG- className={classNames(classes.menuIcon, {- [classes.menuIconDark]: isDark- })}- src={configureIcon}- />- {menuToggle && (+ <div className={classes.menuItemHover}>+ <SVG+ className={classNames(classes.menuIcon, {+ [classes.menuIconDark]: isDark+ })}+ src={configureIcon}+ /><Typographyaria-label="configure"- className={classes.menuListItemText}+ className={classNames(classes.menuListItemText, {+ [classes.menuListItemTextHide]: !menuToggle+ })}>{i18n.t("Configure")}</Typography>- )}+ </div></a>)}</div>diff --git a/saleor/static/dashboard-next/components/AppLayout/MenuNested.tsx b/saleor/static/dashboard-next/components/AppLayout/MenuNested.tsxindex b666dbe51e..15cfa7dc4b 100644--- a/saleor/static/dashboard-next/components/AppLayout/MenuNested.tsx+++ b/saleor/static/dashboard-next/components/AppLayout/MenuNested.tsx@@ -1,12 +1,16 @@+import Hidden from "@material-ui/core/Hidden";import Typography from "@material-ui/core/Typography";import classNames from "classnames";import React from "react";import SVG from "react-inlinesvg";+import useTheme from "@saleor/hooks/useTheme";import { createHref } from "../../misc";import { IActiveSubMenu } from "./MenuList";import { IMenuItem } from "./menuStructure";+import menuArrowIcon from "../../../images/menu-arrow-icon.svg";+export interface MenuNestedProps {activeItem: IActiveSubMenu;ariaLabel: string;@@ -16,12 +20,19 @@ export interface MenuNestedProps {| "menuListItemActive"| "menuListItemText"| "menuListNested"+ | "menuListNestedClose"+ | "menuListNestedCloseDark"+ | "menuListNestedIcon"+ | "menuListNestedIconDark"| "menuListNestedItem"| "menuListNestedOpen"- | "subheader",+ | "subHeader"+ | "subHeaderDark"+ | "subHeaderTitle",string>;closeSubMenu: ({}) => void;+ icon: string;menuItem: IMenuItem;title: string;handleSubMenu: (itemLabel: string) => void;@@ -33,11 +44,13 @@ const MenuNested: React.FC<MenuNestedProps> = ({ariaLabel,classes,closeSubMenu,+ icon,menuItem,onMenuItemClick,title}) => {const menuItems = menuItem.children;+ const { isDark } = useTheme();const closeMenu = (menuItemUrl, event) => {onMenuItemClick(menuItemUrl, event);closeSubMenu({@@ -55,8 +68,36 @@ const MenuNested: React.FC<MenuNestedProps> = ({activeItem.label === ariaLabel && activeItem.isActive})}>- <Typography className={classes.subheader} variant="h5">- {title}+ <Typography+ className={classNames(classes.subHeader, {+ [classes.subHeaderDark]: isDark+ })}+ variant="h5"+ >+ <Hidden mdUp>+ <SVG+ className={classNames(classes.menuListNestedIcon, {+ [classes.menuListNestedIconDark]: isDark+ })}+ src={icon}+ />+ </Hidden>+ <div className={classes.subHeaderTitle}>{title}</div>+ <Hidden mdUp>+ <div+ className={classNames(classes.menuListNestedClose, {+ [classes.menuListNestedCloseDark]: isDark+ })}+ onClick={() =>+ closeSubMenu({+ isActive: false,+ label: ""+ })+ }+ >+ <SVG src={menuArrowIcon} />+ </div>+ </Hidden></Typography>{menuItems.map(item => {return (diff --git a/saleor/static/dashboard-next/components/AppLayout/ResponsiveDrawer.tsx b/saleor/static/dashboard-next/components/AppLayout/ResponsiveDrawer.tsxindex bc55029397..788750be37 100644--- a/saleor/static/dashboard-next/components/AppLayout/ResponsiveDrawer.tsx+++ b/saleor/static/dashboard-next/components/AppLayout/ResponsiveDrawer.tsx@@ -23,10 +23,10 @@ const styles = (theme: Theme) =>},drawerDesktopSmall: {overflow: "visible",+ transition: "width 0.5s ease",width: drawerWidthSmall},drawerMobile: {- padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 4}px`,width: drawerWidth}});