refactor: ♻️ add gridRatio to support two app grids
This commit is contained in:
parent
4a34a4b0c6
commit
ded37d61c3
2 changed files with 23 additions and 7 deletions
|
@ -1,19 +1,30 @@
|
||||||
import { Box } from "@saleor/macaw-ui/next";
|
import { Box } from "@saleor/macaw-ui/next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
const ratioMap = {
|
||||||
|
"1/1": "1fr 1fr",
|
||||||
|
"1/2": "1fr 2fr",
|
||||||
|
};
|
||||||
|
|
||||||
|
type Ratio = keyof typeof ratioMap;
|
||||||
|
|
||||||
|
type AppColumnsProps = {
|
||||||
|
top: React.ReactNode;
|
||||||
|
bottomLeft: React.ReactNode;
|
||||||
|
bottomRight: React.ReactNode;
|
||||||
|
gridRatio?: Ratio;
|
||||||
|
};
|
||||||
|
|
||||||
export const AppColumns = ({
|
export const AppColumns = ({
|
||||||
top,
|
top,
|
||||||
bottomLeft,
|
bottomLeft,
|
||||||
bottomRight,
|
bottomRight,
|
||||||
}: {
|
gridRatio = "1/1",
|
||||||
top: React.ReactNode;
|
}: AppColumnsProps) => {
|
||||||
bottomLeft: React.ReactNode;
|
|
||||||
bottomRight: React.ReactNode;
|
|
||||||
}) => {
|
|
||||||
return (
|
return (
|
||||||
<Box display={"grid"} __gap={"60px"}>
|
<Box display={"grid"} __gap={"60px"}>
|
||||||
<Box>{top}</Box>
|
<Box>{top}</Box>
|
||||||
<Box display={"grid"} gridTemplateColumns={2} gap={10}>
|
<Box display={"grid"} gap={10} __gridTemplateColumns={ratioMap[gridRatio]}>
|
||||||
<Box>{bottomLeft}</Box>
|
<Box>{bottomLeft}</Box>
|
||||||
<Box>{bottomRight}</Box>
|
<Box>{bottomRight}</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
@ -28,7 +28,12 @@ const Intro = () => {
|
||||||
const ConfigurationPage = () => {
|
const ConfigurationPage = () => {
|
||||||
return (
|
return (
|
||||||
<main>
|
<main>
|
||||||
<AppColumns top={<Header />} bottomLeft={<Intro />} bottomRight={<Providers />} />
|
<AppColumns
|
||||||
|
gridRatio="1/2"
|
||||||
|
top={<Header />}
|
||||||
|
bottomLeft={<Intro />}
|
||||||
|
bottomRight={<Providers />}
|
||||||
|
/>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue