Change layout on list and details views to full width (#4013)

This commit is contained in:
Paweł Chyła 2023-07-28 09:32:43 +02:00 committed by GitHub
parent c2b26a3f89
commit 80ef369f8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 20 additions and 21 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---
Make views with list full width

View file

@ -12,7 +12,6 @@ import { useDevModeContext } from "../DevModePanel/hooks";
import { useDevModeKeyTrigger } from "../DevModePanel/useDevModeKeyTrigger"; import { useDevModeKeyTrigger } from "../DevModePanel/useDevModeKeyTrigger";
import Navigator from "../Navigator"; import Navigator from "../Navigator";
import { Sidebar } from "../Sidebar"; import { Sidebar } from "../Sidebar";
import { contentMaxWidth } from "./consts";
import { useStyles } from "./styles"; import { useStyles } from "./styles";
import { extractQueryParams } from "./util"; import { extractQueryParams } from "./util";
@ -64,7 +63,11 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
visible={isNavigatorVisible} visible={isNavigatorVisible}
setVisibility={setNavigatorVisibility} setVisibility={setNavigatorVisibility}
/> />
<Box display="grid" __gridTemplateColumns="auto 1fr"> <Box
display="grid"
__gridTemplateColumns="auto 1fr"
className="big-desktop-max-width"
>
{appState.loading && ( {appState.loading && (
<LinearProgress className={classes.appLoader} color="primary" /> <LinearProgress className={classes.appLoader} color="primary" />
)} )}
@ -96,8 +99,6 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
borderTopWidth={1} borderTopWidth={1}
borderTopStyle="solid" borderTopStyle="solid"
borderColor="neutralPlain" borderColor="neutralPlain"
__maxWidth={contentMaxWidth}
margin="auto"
zIndex="2" zIndex="2"
/> />
</Box> </Box>

View file

@ -1,5 +1,4 @@
export const topBarHeight = "77px"; export const topBarHeight = "77px";
export const appLoaderHeight = 2; export const appLoaderHeight = 2;
export const contentMaxWidth = "1920px";
export const savebarHeight = "64px"; export const savebarHeight = "64px";
export const borderHeight = "1px"; export const borderHeight = "1px";

View file

@ -33,7 +33,6 @@ import React, {
} from "react"; } from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { contentMaxWidth } from "../AppLayout/consts";
import { CardMenuItem } from "../CardMenu"; import { CardMenuItem } from "../CardMenu";
import { ColumnPickerProps } from "../ColumnPicker"; import { ColumnPickerProps } from "../ColumnPicker";
import { FullScreenContainer } from "./components/FullScreenContainer"; import { FullScreenContainer } from "./components/FullScreenContainer";
@ -501,8 +500,6 @@ export const Datagrid: React.FC<DatagridProps> = ({
borderTopWidth={1} borderTopWidth={1}
borderTopStyle="solid" borderTopStyle="solid"
borderColor="neutralPlain" borderColor="neutralPlain"
__maxWidth={contentMaxWidth}
margin="auto"
/> />
<DataEditor <DataEditor
{...datagridProps} {...datagridProps}

View file

@ -1,6 +1,5 @@
import { import {
borderHeight, borderHeight,
contentMaxWidth,
savebarHeight, savebarHeight,
} from "@dashboard/components/AppLayout/consts"; } from "@dashboard/components/AppLayout/consts";
import { Box, Sprinkles } from "@saleor/macaw-ui/next"; import { Box, Sprinkles } from "@saleor/macaw-ui/next";
@ -45,10 +44,8 @@ export const RootLayout: React.FC<DetailPageLayoutProps> = ({
// https://github.com/saleor/macaw-ui/issues/498 // https://github.com/saleor/macaw-ui/issues/498
className="mobile-full-height" className="mobile-full-height"
display="grid" display="grid"
margin="auto"
gridTemplateColumns={gridTemplateColumnsValue} gridTemplateColumns={gridTemplateColumnsValue}
__gridTemplateRows="auto 1fr" __gridTemplateRows="auto 1fr"
__maxWidth={contentMaxWidth}
__height={heightValue} __height={heightValue}
> >
{children} {children}

View file

@ -1,4 +1,3 @@
import { contentMaxWidth } from "@dashboard/components/AppLayout/consts";
import { Box } from "@saleor/macaw-ui/next"; import { Box } from "@saleor/macaw-ui/next";
import React from "react"; import React from "react";
@ -9,13 +8,7 @@ interface ListPageLayoutProps {
} }
export const ListPageLayout: React.FC<ListPageLayoutProps> = ({ children }) => ( export const ListPageLayout: React.FC<ListPageLayoutProps> = ({ children }) => (
<Box <Box display="grid" gridTemplateColumns={1} height="100%">
display="grid"
margin="auto"
gridTemplateColumns={1}
height="100%"
__maxWidth={contentMaxWidth}
>
{children} {children}
</Box> </Box>
); );

View file

@ -8,7 +8,7 @@ import {
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { contentMaxWidth, savebarHeight } from "./AppLayout/consts"; import { savebarHeight } from "./AppLayout/consts";
export interface SavebarProps extends Omit<MacawSavebarProps, "labels"> { export interface SavebarProps extends Omit<MacawSavebarProps, "labels"> {
labels?: Partial<SavebarLabels>; labels?: Partial<SavebarLabels>;
@ -21,7 +21,7 @@ const useStyles = makeStyles(
"& .MuiContainer-root": { "& .MuiContainer-root": {
paddingRight: 0, paddingRight: 0,
paddingLeft: 0, paddingLeft: 0,
maxWidth: contentMaxWidth, maxWidth: "100%",
margin: "0 auto", margin: "0 auto",
}, },
"& .MuiPaper-root": { "& .MuiPaper-root": {

View file

@ -62,3 +62,10 @@ body {
height: auto !important; height: auto !important;
} }
} }
@media screen and (min-width: 2048px) {
.big-desktop-max-width {
max-width: 1920px !important;
margin: 0 auto;
}
}