Skip to content

Commit

Permalink
Merge pull request #48 from aum-deriv/aum/FEQ-1654/pagelayout-improve…
Browse files Browse the repository at this point in the history
…ments-remove-right-content-flex

[FEQ] aum/FEQ-1654/pagelayout-improvements-remove-right-content-flex
  • Loading branch information
shayan-deriv authored Feb 2, 2024
2 parents ab4c127 + 1cddcb8 commit 10d57ec
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 71 deletions.
25 changes: 0 additions & 25 deletions lib/components/Layout/PageLayout.scss

This file was deleted.

18 changes: 0 additions & 18 deletions lib/components/Layout/index.tsx

This file was deleted.

13 changes: 1 addition & 12 deletions lib/components/PageLayout/PageLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,7 @@
flex-direction: column;
}

&__left {
display: flex;
flex-direction: column;
}

&__content {
display: flex;
flex-direction: column;
}

&__right {
display: flex;
flex-direction: column;
flex: 1;
}
}
8 changes: 3 additions & 5 deletions lib/components/PageLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { useDevice } from '../../hooks/useDevice';
import './PageLayout.scss';

type PageLayoutProps = {
left?: JSX.Element;
right?: JSX.Element;
sidebar?: JSX.Element;
};

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

return <div className="derivs-page-layout">
{left && !isMobile && <div className="derivs-page-layout__left">{left}</div>}
{sidebar && !isMobile && <div className="derivs-page-layout__sidebar">{sidebar}</div>}
{children && <div className="derivs-page-layout__content">{children}</div>}
{right && <div className="derivs-page-layout__right">{right}</div>}
</div>
}
2 changes: 1 addition & 1 deletion lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { Button } from "./components/Button";
export { Dropdown } from "./components/Dropdown";
export { Input } from "./components/Input";
export { Loader } from "./components/Loader";
export { PageLayout } from "./components/Layout";
export { PageLayout } from "./components/PageLayout";
export { Tab, Tabs } from "./components/Tabs";
export { Text } from "./components/Text";
export { ToggleSwitch } from "./components/ToggleSwitch";
Expand Down
14 changes: 4 additions & 10 deletions src/stories/PageLayout.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const meta = {
title: "Components/PageLayout",
component: PageLayout,
args: {
left: (
sidebar: (
<Pane name="Left">
<div style={{ fontWeight: "bold" }}>
*This pane is hidden in mobile view.
Expand All @@ -36,7 +36,6 @@ const meta = {
view.
</Pane>
),
right: <Pane name="Right">The content on the right.</Pane>,
children: (
<Pane name="Content">
<div style={{ fontWeight: "bold" }}>
Expand All @@ -59,16 +58,11 @@ const meta = {
),
},
argTypes: {
left: {
sidebar: {
control: false,
description:
"JSX element to be rendered on the left of the content as render-prop.",
},
right: {
control: false,
description:
"JSX element to be rendered on the right of the content as render-prop.",
},
children: {
control: false,
description: "Children to be rendered as the content.",
Expand All @@ -78,8 +72,8 @@ const meta = {
layout: "centered",
},
tags: ["autodocs"],
render: ({ children, left, right }) => (
<PageLayout left={left} right={right}>
render: ({ children, sidebar }) => (
<PageLayout sidebar={sidebar}>
{children}
</PageLayout>
),
Expand Down

0 comments on commit 10d57ec

Please sign in to comment.