Skip to content

Commit 10d57ec

Browse files
authored
Merge pull request #48 from aum-deriv/aum/FEQ-1654/pagelayout-improvements-remove-right-content-flex
[FEQ] aum/FEQ-1654/pagelayout-improvements-remove-right-content-flex
2 parents ab4c127 + 1cddcb8 commit 10d57ec

File tree

6 files changed

+9
-71
lines changed

6 files changed

+9
-71
lines changed

lib/components/Layout/PageLayout.scss

-25
This file was deleted.

lib/components/Layout/index.tsx

-18
This file was deleted.

lib/components/PageLayout/PageLayout.scss

+1-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@
88
flex-direction: column;
99
}
1010

11-
&__left {
12-
display: flex;
13-
flex-direction: column;
14-
}
15-
1611
&__content {
17-
display: flex;
18-
flex-direction: column;
19-
}
20-
21-
&__right {
22-
display: flex;
23-
flex-direction: column;
12+
flex: 1;
2413
}
2514
}

lib/components/PageLayout/index.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ import { useDevice } from '../../hooks/useDevice';
33
import './PageLayout.scss';
44

55
type PageLayoutProps = {
6-
left?: JSX.Element;
7-
right?: JSX.Element;
6+
sidebar?: JSX.Element;
87
};
98

10-
export const PageLayout: React.FC<React.PropsWithChildren<PageLayoutProps>> = ({children, left, right}) => {
9+
export const PageLayout: React.FC<React.PropsWithChildren<PageLayoutProps>> = ({children, sidebar}) => {
1110
const {isMobile} = useDevice();
1211

1312
return <div className="derivs-page-layout">
14-
{left && !isMobile && <div className="derivs-page-layout__left">{left}</div>}
13+
{sidebar && !isMobile && <div className="derivs-page-layout__sidebar">{sidebar}</div>}
1514
{children && <div className="derivs-page-layout__content">{children}</div>}
16-
{right && <div className="derivs-page-layout__right">{right}</div>}
1715
</div>
1816
}

lib/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export { Button } from "./components/Button";
22
export { Dropdown } from "./components/Dropdown";
33
export { Input } from "./components/Input";
44
export { Loader } from "./components/Loader";
5-
export { PageLayout } from "./components/Layout";
5+
export { PageLayout } from "./components/PageLayout";
66
export { Tab, Tabs } from "./components/Tabs";
77
export { Text } from "./components/Text";
88
export { ToggleSwitch } from "./components/ToggleSwitch";

src/stories/PageLayout.stories.tsx

+4-10
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const meta = {
2727
title: "Components/PageLayout",
2828
component: PageLayout,
2929
args: {
30-
left: (
30+
sidebar: (
3131
<Pane name="Left">
3232
<div style={{ fontWeight: "bold" }}>
3333
*This pane is hidden in mobile view.
@@ -36,7 +36,6 @@ const meta = {
3636
view.
3737
</Pane>
3838
),
39-
right: <Pane name="Right">The content on the right.</Pane>,
4039
children: (
4140
<Pane name="Content">
4241
<div style={{ fontWeight: "bold" }}>
@@ -59,16 +58,11 @@ const meta = {
5958
),
6059
},
6160
argTypes: {
62-
left: {
61+
sidebar: {
6362
control: false,
6463
description:
6564
"JSX element to be rendered on the left of the content as render-prop.",
6665
},
67-
right: {
68-
control: false,
69-
description:
70-
"JSX element to be rendered on the right of the content as render-prop.",
71-
},
7266
children: {
7367
control: false,
7468
description: "Children to be rendered as the content.",
@@ -78,8 +72,8 @@ const meta = {
7872
layout: "centered",
7973
},
8074
tags: ["autodocs"],
81-
render: ({ children, left, right }) => (
82-
<PageLayout left={left} right={right}>
75+
render: ({ children, sidebar }) => (
76+
<PageLayout sidebar={sidebar}>
8377
{children}
8478
</PageLayout>
8579
),

0 commit comments

Comments
 (0)