diff --git a/src/categories/components/CategoryCreatePage/CategoryCreatePage.tsx b/src/categories/components/CategoryCreatePage/CategoryCreatePage.tsx index 06e7d1119..3d6aef91a 100644 --- a/src/categories/components/CategoryCreatePage/CategoryCreatePage.tsx +++ b/src/categories/components/CategoryCreatePage/CategoryCreatePage.tsx @@ -36,7 +36,7 @@ export const CategoryCreatePage: React.FC = ({ return ( {({ data, change, handlers, submit, isSaveDisabled }) => ( - + = ({ disabled={disabled} > {({ data, change, handlers, submit, isSaveDisabled }) => ( - + = ({ children }) => { borderColor="neutralPlain" __maxWidth={contentMaxWidth} margin="auto" - // @ts-ignore - __zIndex="3" + zIndex="3" /> diff --git a/src/components/AppLayout/Content.tsx b/src/components/AppLayout/Content.tsx index 2eb74bb81..1b3dcd59b 100644 --- a/src/components/AppLayout/Content.tsx +++ b/src/components/AppLayout/Content.tsx @@ -1,21 +1,32 @@ import { Box } from "@saleor/macaw-ui/next"; import React from "react"; -import { borderHeight, savebarHeight, topBarHeight } from "./consts"; +import { useContentHeight } from "./useContentHeight"; interface ContentProps { [key: `data-${string}`]: string; children: React.ReactNode; + noSavebar?: boolean; + noTopNav?: boolean; } -export const Content: React.FC = ({ children, ...rest }) => ( - - {children} - -); +export const Content: React.FC = ({ + children, + noSavebar = false, + noTopNav = false, + ...rest +}) => { + const { withoutSaveBar, withSaveBar } = useContentHeight(); + + return ( + + {children} + + ); +}; diff --git a/src/components/AppLayout/RightSidebar.tsx b/src/components/AppLayout/RightSidebar.tsx index 7a185b22a..ad7dbe30d 100644 --- a/src/components/AppLayout/RightSidebar.tsx +++ b/src/components/AppLayout/RightSidebar.tsx @@ -7,17 +7,21 @@ import { borderHeight, savebarHeight } from "./consts"; interface RightSidebarProps { children: React.ReactNode; className?: string; + noSavebar?: boolean; } export const RightSidebar: React.FC = ({ children, + noSavebar = false, className, }) => ( { + it("should return the correct height without savebar", () => { + const { withoutSaveBar } = useContentHeight(); + const height = withoutSaveBar(); + + expect(height).toEqual("calc(100vh - 77px - 1px)"); + }); + + it("should return the correct height with savebar", () => { + const { withSaveBar } = useContentHeight(); + const height = withSaveBar({ noTopNav: false }); + + expect(height).toEqual("calc(100vh - 77px - 64px - 1px)"); + }); + + it("should return the correct height with savebar and no top nav", () => { + const { withSaveBar } = useContentHeight(); + const height = withSaveBar({ noTopNav: true }); + + expect(height).toEqual("calc(100vh - 0px - 64px - 1px)"); + }); +}); diff --git a/src/components/AppLayout/useContentHeight.ts b/src/components/AppLayout/useContentHeight.ts new file mode 100644 index 000000000..76fb4cc46 --- /dev/null +++ b/src/components/AppLayout/useContentHeight.ts @@ -0,0 +1,14 @@ +import { borderHeight, savebarHeight, topBarHeight } from "./consts"; + +export const useContentHeight = () => { + const withoutSaveBar = () => + `calc(100vh - ${topBarHeight} - ${borderHeight})`; + + const withSaveBar = ({ noTopNav }) => { + const topHeight = noTopNav ? "0px" : topBarHeight; + + return `calc(100vh - ${topHeight} - ${savebarHeight} - ${borderHeight})`; + }; + + return { withoutSaveBar, withSaveBar }; +}; diff --git a/src/configuration/ConfigurationPage.tsx b/src/configuration/ConfigurationPage.tsx index 1fca848e9..c6ffa6ce0 100644 --- a/src/configuration/ConfigurationPage.tsx +++ b/src/configuration/ConfigurationPage.tsx @@ -99,7 +99,7 @@ export const ConfigurationPage: React.FC = props => { {isSmUp && renderVersionInfo} - + {menus .filter(menu => diff --git a/src/custom-apps/components/CustomAppListPage/CustomAppListPage.tsx b/src/custom-apps/components/CustomAppListPage/CustomAppListPage.tsx index 75f238726..30112141a 100644 --- a/src/custom-apps/components/CustomAppListPage/CustomAppListPage.tsx +++ b/src/custom-apps/components/CustomAppListPage/CustomAppListPage.tsx @@ -1,4 +1,7 @@ -import { Content } from "@dashboard/components/AppLayout/Content"; +import { + borderHeight, + topBarHeight, +} from "@dashboard/components/AppLayout/consts"; import { TopNav } from "@dashboard/components/AppLayout/TopNav"; import { Button } from "@dashboard/components/Button"; import { TableButtonWrapper } from "@dashboard/components/TableButtonWrapper/TableButtonWrapper"; @@ -46,72 +49,73 @@ const CustomAppListPage: React.FC = ({ /> - - - - - + - - + id="L/sNGY" + /> + + - - - {renderCollection( - appsList, - (app, index) => - app ? ( - - - - {app.name} - - {!app.isActive && ( -
- -
- )} -
- - - onRemove(app.id)} - > - - - - -
- ) : ( - - ), - () => ( - + + + {renderCollection( + appsList, + (app, index) => + app ? ( + - - - + + {app.name} + + {!app.isActive && ( +
+ +
+ )} +
+ + + onRemove(app.id)} + > + + +
+ ) : ( + ), - )} -
-
- -
+ () => ( + + + + + + + + ), + )} + + + ); }; diff --git a/src/customers/components/CustomerCreatePage/CustomerCreatePage.tsx b/src/customers/components/CustomerCreatePage/CustomerCreatePage.tsx index 91b48437c..5c2d0dd6e 100644 --- a/src/customers/components/CustomerCreatePage/CustomerCreatePage.tsx +++ b/src/customers/components/CustomerCreatePage/CustomerCreatePage.tsx @@ -1,9 +1,9 @@ import { createCountryHandler } from "@dashboard/components/AddressEdit/createCountryHandler"; import { Content } from "@dashboard/components/AppLayout/Content"; +import { DetailedContent } from "@dashboard/components/AppLayout/DetailedContent"; import { TopNav } from "@dashboard/components/AppLayout/TopNav"; import { CardSpacer } from "@dashboard/components/CardSpacer"; import Form from "@dashboard/components/Form"; -import Grid from "@dashboard/components/Grid"; import Savebar from "@dashboard/components/Savebar"; import { customerListUrl } from "@dashboard/customers/urls"; import { @@ -152,7 +152,7 @@ const CustomerCreatePage: React.FC = ({ const handleCountrySelect = createCountryHandler(countrySelect, set); return ( - <> + = ({ })} /> - -
- - - - - -
-
+
+ + + + + +
= ({ onCancel={() => navigate(customerListUrl())} />
- +
); }} diff --git a/src/home/components/HomePage/HomePage.tsx b/src/home/components/HomePage/HomePage.tsx index c29091c98..8d0ffa56b 100644 --- a/src/home/components/HomePage/HomePage.tsx +++ b/src/home/components/HomePage/HomePage.tsx @@ -80,7 +80,7 @@ const HomePage: React.FC = props => { return ( } /> - + = props => { {activities && ( - + diff --git a/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx b/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx index e1a9185d1..49d99e0c8 100644 --- a/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx +++ b/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx @@ -86,8 +86,8 @@ const MenuDetailsPage: React.FC = ({ return (
{({ change, data, submit }) => ( - - + + {intl.formatMessage(sectionNames.navigation)} diff --git a/src/navigation/components/MenuListPage/MenuListPage.tsx b/src/navigation/components/MenuListPage/MenuListPage.tsx index 4468e5649..eaa0344a0 100644 --- a/src/navigation/components/MenuListPage/MenuListPage.tsx +++ b/src/navigation/components/MenuListPage/MenuListPage.tsx @@ -1,3 +1,7 @@ +import { + borderHeight, + topBarHeight, +} from "@dashboard/components/AppLayout/consts"; import { TopNav } from "@dashboard/components/AppLayout/TopNav"; import { Button } from "@dashboard/components/Button"; import { configurationMenuUrl } from "@dashboard/configuration"; @@ -5,6 +9,7 @@ import { MenuFragment } from "@dashboard/graphql"; import { sectionNames } from "@dashboard/intl"; import { menuListUrl, MenuListUrlSortField } from "@dashboard/navigation/urls"; import { ListActions, PageListProps, SortPage } from "@dashboard/types"; +import { Box } from "@saleor/macaw-ui/next"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -38,7 +43,9 @@ const MenuListPage: React.FC = ({ ...listProps }) => { /> - + + + ); }; diff --git a/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx b/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx index dd85b6f59..48e3f2de8 100644 --- a/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx +++ b/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx @@ -14,7 +14,7 @@ import TableRowLink from "@dashboard/components/TableRowLink"; import { AttributeFragment, AttributeTypeEnum } from "@dashboard/graphql"; import { renderCollection } from "@dashboard/misc"; import { ListActions, ReorderAction } from "@dashboard/types"; -import { Card, TableCell } from "@material-ui/core"; +import { Card, CardContent, TableCell } from "@material-ui/core"; import { DeleteIcon, IconButton, makeStyles } from "@saleor/macaw-ui"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -95,93 +95,95 @@ const PageTypeAttributes: React.FC = props => { } /> - - - - - - - - - {attributes?.length > 0 && ( - - - - - - - - - - )} - - {renderCollection( - attributes, - (attribute, attributeIndex) => { - const isSelected = attribute ? isChecked(attribute.id) : false; + + + + + + + + + + {attributes?.length > 0 && ( + + + + + + + + + + )} + + {renderCollection( + attributes, + (attribute, attributeIndex) => { + const isSelected = attribute ? isChecked(attribute.id) : false; - return ( - - - toggle(attribute.id)} + return ( + + + toggle(attribute.id)} + /> + + + {attribute?.name || } + + + {attribute?.slug || } + + + + onAttributeUnassign(attribute.id)} + > + + + + + + ); + }, + () => ( + + + - - {attribute?.name || } - - - {attribute?.slug || } - - - - onAttributeUnassign(attribute.id)} - > - - - - - - ); - }, - () => ( - - - - - - ), - )} - - + + ), + )} + + + ); }; diff --git a/src/pageTypes/components/PageTypeDetailsPage/PageTypeDetailsPage.tsx b/src/pageTypes/components/PageTypeDetailsPage/PageTypeDetailsPage.tsx index aa7f1c60e..50906bf8b 100644 --- a/src/pageTypes/components/PageTypeDetailsPage/PageTypeDetailsPage.tsx +++ b/src/pageTypes/components/PageTypeDetailsPage/PageTypeDetailsPage.tsx @@ -118,7 +118,7 @@ const PageTypeDetailsPage: React.FC = props => { const changeMetadata = makeMetadataChangeHandler(change); return ( - + = ({ description: "header", })} /> - + - + diff --git a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx index 7bb837c92..ee2f8958d 100644 --- a/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx +++ b/src/siteSettings/components/SiteSettingsPage/SiteSettingsPage.tsx @@ -139,7 +139,7 @@ const SiteSettingsPage: React.FC = props => { const handleCountrySelect = createCountryHandler(countrySelect, set); return ( - +