diff --git a/lib/components/Layout/PageLayout.scss b/lib/components/Layout/PageLayout.scss deleted file mode 100644 index 893f31ea..00000000 --- a/lib/components/Layout/PageLayout.scss +++ /dev/null @@ -1,25 +0,0 @@ -.layout { - width: 100%; - display: flex; - gap: 1.5rem; - padding-top: 1.5rem; - - @include mobile { - flex-direction: column; - } - - &__left { - display: flex; - flex-direction: column; - } - - &__content { - display: flex; - flex-direction: column; - } - - &__right { - display: flex; - flex-direction: column; - } -} diff --git a/lib/components/Layout/index.tsx b/lib/components/Layout/index.tsx deleted file mode 100644 index f68f9295..00000000 --- a/lib/components/Layout/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { useDevice } from '../../hooks/useDevice'; -import './PageLayout.scss'; - -type PageLayoutProps = { - left?: JSX.Element; - right?: JSX.Element; -}; - -export const PageLayout: React.FC> = ({children, left, right}) => { - const {isMobile} = useDevice(); - - return
- {left && !isMobile &&
{left}
} - {children &&
{children}
} - {right &&
{right}
} -
-} \ No newline at end of file diff --git a/lib/components/PageLayout/PageLayout.scss b/lib/components/PageLayout/PageLayout.scss index ffc377e6..2be4c996 100644 --- a/lib/components/PageLayout/PageLayout.scss +++ b/lib/components/PageLayout/PageLayout.scss @@ -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; } } diff --git a/lib/components/PageLayout/index.tsx b/lib/components/PageLayout/index.tsx index 4f7d015d..f3d4685f 100644 --- a/lib/components/PageLayout/index.tsx +++ b/lib/components/PageLayout/index.tsx @@ -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> = ({children, left, right}) => { +export const PageLayout: React.FC> = ({children, sidebar}) => { const {isMobile} = useDevice(); return
- {left && !isMobile &&
{left}
} + {sidebar && !isMobile &&
{sidebar}
} {children &&
{children}
} - {right &&
{right}
}
} \ No newline at end of file diff --git a/lib/main.ts b/lib/main.ts index 7818aaff..8160d27a 100644 --- a/lib/main.ts +++ b/lib/main.ts @@ -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"; diff --git a/src/stories/PageLayout.stories.tsx b/src/stories/PageLayout.stories.tsx index 54d1831b..8cb7a99a 100644 --- a/src/stories/PageLayout.stories.tsx +++ b/src/stories/PageLayout.stories.tsx @@ -27,7 +27,7 @@ const meta = { title: "Components/PageLayout", component: PageLayout, args: { - left: ( + sidebar: (
*This pane is hidden in mobile view. @@ -36,7 +36,6 @@ const meta = { view. ), - right: The content on the right., children: (
@@ -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.", @@ -78,8 +72,8 @@ const meta = { layout: "centered", }, tags: ["autodocs"], - render: ({ children, left, right }) => ( - + render: ({ children, sidebar }) => ( + {children} ),