Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEQ] aum/FEQ-1654/pagelayout-improvements-remove-right-content-flex #48

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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