Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Loading POC
Browse files Browse the repository at this point in the history
  • Loading branch information
dgalarza committed Feb 8, 2023
1 parent 4dd886a commit 830d0ac
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
25 changes: 22 additions & 3 deletions packages/components/page_template/src/page_content.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
import { Box, BoxProps } from "@buoysoftware/anchor-layout";
import { LoadingIndicator } from "@buoysoftware/anchor-loading-indicator";

type PageContentProps = Omit<BoxProps, "gridArea">;
interface OwnProps {
loading?: boolean;
}

type PageContentProps = OwnProps & Omit<BoxProps, "gridArea">;

export const PageContent: React.FC<PageContentProps> = ({
children,
loading,
...props
}): React.ReactElement => {
return (
<Box gridArea="content" mt="40px" px="page.gutterX" {...props}>
{children}
<Box
gridArea="content"
display={loading ? "grid" : "block"}
mt="40px"
px="page.gutterX"
{...props}
>
{loading ? (
<Box justifySelf="center" alignSelf="center">
<LoadingIndicator strokeSize={2} size={40} color="grey70" />
<p>Loading</p>
</Box>
) : (
children
)}
</Box>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Canvas, Story } from "@storybook/addon-docs";

import { LoadingIndicator } from "@buoysoftware/anchor-loading-indicator";
import { DropdownMenu, DropdownMenuList, DropdownMenuItem } from "@buoysoftware/anchor-dropdown-menu";
import { Flex } from "@buoysoftware/anchor-layout";
import { Box, Flex } from "@buoysoftware/anchor-layout";
import { Breadcrumbs, Breadcrumb } from "@buoysoftware/anchor-breadcrumbs";
import { Button } from "@buoysoftware/anchor-button";

Expand Down Expand Up @@ -83,3 +84,21 @@ import { PageActionBar, PageBreadcrumbs, PageContent, PageFooter, PageHeader, Pa
</PageTemplate>
</Story>
</Canvas>

## With Loader

<Canvas>
<Story name="with Loader" args={{}}>
<PageTemplate>
<PageBreadcrumbs>
<Breadcrumbs>
<Breadcrumb>Questionnaires</Breadcrumb>
</Breadcrumbs>
</PageBreadcrumbs>
<PageHeader title="Template example" />
<PageContent loading>
Content is loading
</PageContent>
</PageTemplate>
</Story>
</Canvas>

0 comments on commit 830d0ac

Please sign in to comment.