Skip to content

Commit

Permalink
Merge branch 'main' into feat/details-component-page
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisolsen authored Nov 10, 2023
2 parents 3dee583 + 7cf1254 commit 7320cac
Show file tree
Hide file tree
Showing 6 changed files with 591 additions and 43 deletions.
17 changes: 14 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Route,
RouterProvider,
createBrowserRouter,
createRoutesFromElements,
createRoutesFromElements
} from "react-router-dom";
import ComponentsPage from "./routes/components/Components";
import DropdownPage from "./routes/components/Dropdown";
Expand All @@ -13,7 +13,11 @@ import ButtonPage from "./routes/components/Button";
import FormStepperPage from "./routes/components/FormStepper";
import CheckboxPage from "./routes/components/Checkbox";
import BadgePage from "./routes/components/Badge";

import DetailsPage from "./routes/components/Details";
import ListPage from "@routes/components/List";
import PopoverPage from "./routes/components/Popover";
import ContainerPage from "@routes/components/Container";
import SkeletonPage from "@routes/components/Skeleton.tsx";
import AllComponentsPage from "./routes/components/AllComponents";
import ComponentNotFoundPage from "./routes/not-found/NotFound";
Expand Down Expand Up @@ -45,7 +49,10 @@ import DevelopersSetupPage from "./routes/get-started/developers/DevelopersSetup

import { useMediaQuery } from "./hooks/useMediaQuery.tsx";
import { DeviceWidthContext } from "./contexts/DeviceWidthContext.ts";
import HomePage from '@routes/home';
import HomePage from "@routes/home";




interface DeviceWidthProviderProps {
children: ReactNode;
Expand All @@ -66,15 +73,19 @@ const router = createBrowserRouter(
createRoutesFromElements(
<Route path="/" element={<Root />}>
<Route path="/" element={<HomePage />} />
<Route path="components" element={<ComponentsPage />} errorElement={<ComponentNotFoundPage />} >
<Route path="components" element={<ComponentsPage />} errorElement={<ComponentNotFoundPage />}>
<Route index element={<AllComponentsPage />} />
<Route path="accordion" element={<AccordionPage />} />
<Route path="button" element={<ButtonPage />} />
<Route path="dropdown" element={<DropdownPage />} />
<Route path="form-stepper" element={<FormStepperPage />} />
<Route path="checkbox" element={<CheckboxPage />} />
<Route path="badge" element={<BadgePage />} />
<Route path="popover" element={<PopoverPage />} />
<Route path="badge" element={<BadgePage/>} />
<Route path="details" element={<DetailsPage />} />
<Route path="list" element={<ListPage/>} />
<Route path='container' element={<ContainerPage />} />
<Route path="skeleton-loader" element={<SkeletonPage/>} />ß
<Route path="*" element={<ComponentNotFoundPage />} />
</Route>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ export default function ButtonPage() {
<ComponentProperties properties={componentProperties} />

{/*Button Examples*/}
<goa-block gap="xs" direction="column" mt="2xl" mb="3xl">
<GoABlock gap="xs" direction="column" mt="2xl" mb="3xl">
<a href="#ask-address">Ask a user for an address</a>
<a href="#confirm-action">Confirm a destructive action</a>
<a href="#disabled-button">Disabled button in a form</a>
</goa-block>
</GoABlock>
<h3 id="ask-address">Ask a user for an address</h3>
<Sandbox flags={["reactive"]}>
<GoAFormItem label="Street Address">
Expand Down
77 changes: 39 additions & 38 deletions src/routes/components/Components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,44 +28,45 @@ export function Components() {
<GoADropdownItem label="Angular" value="angular" />
</GoADropdown>

<GoASideMenu>
<Link to="">All</Link>
<Link to="accordion">Accordion</Link>
<Link to="badge">Badge</Link>
<Link to="block">Block</Link>
<Link to="button">Button</Link>
<Link to="callout">Callout</Link>
<Link to="checkbox">Checkbox</Link>
<Link to="chip">Chip</Link>
<Link to="combobox">Combobox</Link>
<Link to="container">Container</Link>
<Link to="details">Details</Link>
<Link to="divider">Divider</Link>
<Link to="dropdown">Dropdown</Link>
<Link to="file-uploader">File uploader</Link>
<Link to="footer">Footer</Link>
<Link to="form-item">Form item</Link>
<Link to="grid">Grid</Link>
<Link to="hero-banner">Hero banner</Link>
<Link to="icons">Icons</Link>
<Link to="list">List</Link>
<Link to="microsite-header">Microsite header</Link>
<Link to="modal">Modal</Link>
<Link to="notification-banner">Notification banner</Link>
<Link to="pagination">Pagination</Link>
<Link to="progress-indicator">Progress indicator</Link>
<Link to="radio">Radio</Link>
<Link to="skeleton-loader">Skeleton loader</Link>
<Link to="snackbar">Snackbar</Link>
<Link to="spacer">Spacer</Link>
<Link to="site-header">Site header</Link>
<Link to="form-stepper">Stepper</Link>
<Link to="table">Table</Link>
<Link to="text-area">Text area</Link>
<Link to="text-field">Text field</Link>
<Link to="tooltip">Tooltip</Link>
</GoASideMenu>
</section>
<GoASideMenu>
<Link to="">All</Link>
<Link to="accordion">Accordion</Link>
<Link to="badge">Badge</Link>
<Link to="block">Block</Link>
<Link to="button">Button</Link>
<Link to="callout">Callout</Link>
<Link to="checkbox">Checkbox</Link>
<Link to="chip">Chip</Link>
<Link to="combobox">Combobox</Link>
<Link to="container">Container</Link>
<Link to="details">Details</Link>
<Link to="divider">Divider</Link>
<Link to="dropdown">Dropdown</Link>
<Link to="file-uploader">File uploader</Link>
<Link to="footer">Footer</Link>
<Link to="form-item">Form item</Link>
<Link to="grid">Grid</Link>
<Link to="hero-banner">Hero banner</Link>
<Link to="icons">Icons</Link>
<Link to="list">List</Link>
<Link to="microsite-header">Microsite header</Link>
<Link to="modal">Modal</Link>
<Link to="notification-banner">Notification banner</Link>
<Link to="pagination">Pagination</Link>
<Link to="popover">Popover</Link>
<Link to="progress-indicator">Progress indicator</Link>
<Link to="radio">Radio</Link>
<Link to="skeleton-loader">Skeleton loader</Link>
<Link to="snackbar">Snackbar</Link>
<Link to="spacer">Spacer</Link>
<Link to="site-header">Site header</Link>
<Link to="form-stepper">Stepper</Link>
<Link to="table">Table</Link>
<Link to="text-area">Text area</Link>
<Link to="text-field">Text field</Link>
<Link to="tooltip">Tooltip</Link>
</GoASideMenu>
</section>

<main className="main">
<Outlet />
Expand Down
203 changes: 203 additions & 0 deletions src/routes/components/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
import { useState } from "react";
import { ComponentBinding, Sandbox } from "@components/sandbox";
import {
ComponentProperties,
ComponentProperty,
} from "@components/component-properties/ComponentProperties";
import { Category, ComponentHeader } from "@components/component-header/ComponentHeader";
import {
GoABadge,
GoABlock,
GoAButton,
GoACallout,
GoAContainer,
GoATab,
GoATable,
GoATabs,
} from "@abgov/react-components";

export default function ContainerPage() {
const [containerProps, setContainerProps] = useState({});
const [containerBindings, setContainerBindings] = useState<ComponentBinding[]>([
{
label: "Type",
type: "list",
name: "type",
options: ["", "interactive", "info", "error", "success", "important", "non-interactive"],
value: "",
defaultValue: "interactive",
},
{
label: "Accent",
type: "list",
name: "accent",
options: ["", "thick", "thin", "filled"],
value: "",
defaultValue: "filled",
},
{
label: "Padding",
type: "list",
name: "padding",
options: ["", "relaxed", "compact"],
value: "",
defaultValue: "relaxed",
},
]);

const componentProperties: ComponentProperty[] = [
{
name: "type",
type: "interactive | info | error | success | important | non-interactive",
description: "Choose the type of container the type of the accent bar",
defaultValue: "interactive",
},
{
name: "accent",
type: "thick | thin | filled",
defaultValue: "filled",
description: "Sets the style of accent on the container",
},
{
name: "padding",
type: "relaxed | compact",
defaultValue: "relaxed",
description: "Sets the amount of white space in the container",
},
{
name: "title",
type: "slot",
description:
"Sets the content in the left of the accent bar. To only beused along with accent=thick.",
},
{
name: "actions",
type: "slot",
description:
"Sets the content in the right of the accent bar. To only be used along with accent=thick.",
},
];

function onSandboxChange(bindings: ComponentBinding[], props: Record<string, unknown>) {
setContainerBindings(bindings);
setContainerProps(props);
}

return (
<>
<ComponentHeader
name="Container"
category={Category.CONTENT_AND_LAYOUT}
description="Group information, create hierarchy, and show related information."
/>

<GoATabs>
<GoATab heading={"Code examples"}>
<Sandbox properties={containerBindings} onChange={onSandboxChange} fullWidth>
<GoAContainer {...containerProps}>
<h2>Detach to use</h2>
<p>Add things inside me</p>
</GoAContainer>
</Sandbox>

{/*Container Table Properties*/}
<ComponentProperties properties={componentProperties} />

{/*Container examples*/}
<GoABlock gap="xs" direction="column" mt="2xl" mb="3xl">
<a href="#accent-bar-with-heading">Accent bar with heading</a>
<a href="#accent-bar-with-badge">Accent bar with badge</a>
<a href="#accent-bar-with-button">Accent bar with button</a>
<a href="#container-inside-container">Container with container inside</a>
<a href="#complex-container">Container with complex content</a>
</GoABlock>

<h3 id="accent-bar-with-heading">Accent bar with heading</h3>
<Sandbox fullWidth>
<GoAContainer accent="thick" heading="Group Heading">
Content
</GoAContainer>
</Sandbox>

<h3 id="accent-bar-with-badge">Accent bar with badge</h3>
<Sandbox fullWidth>
<GoAContainer
type="non-interactive"
accent="thick"
heading="Group Heading"
actions={<GoABadge type="success" content="Badge Text" icon={true} />}
>
Content
</GoAContainer>
</Sandbox>

<h3 id="accent-bar-with-button">Accent bar with button</h3>
<Sandbox fullWidth>
<GoAContainer
type="non-interactive"
accent="thick"
heading="Group Heading"
actions={
<GoAButton type="secondary" size="compact">
Edit
</GoAButton>
}
>
Content
</GoAContainer>
</Sandbox>

<h3 id="container-inside-container">Container with container inside</h3>
<Sandbox fullWidth>
<GoAContainer accent="thick">
<h2>Heading</h2>
<p>Content</p>
<GoAContainer type="non-interactive">
<h2>Heading</h2>
<p>Content</p>
</GoAContainer>
</GoAContainer>
</Sandbox>

<h3 id="complex-container">Container with complex content</h3>
<Sandbox fullWidth>
<GoAContainer>
<h2>Heading</h2>
<GoATable width="100%">
<tbody>
<tr>
<td>Content</td>
<td align="right">$2,110.00</td>
</tr>
<tr>
<td>Content</td>
<td align="right">$525.00</td>
</tr>
<tr>
<td>Content</td>
<td align="right">$275.00</td>
</tr>
</tbody>
</GoATable>
<GoACallout type="important" mt="l">
Lorem ipsum dolor sit amet, qui minim labore adipisicing minim sint cillum sint
consectetur cupidatat.
</GoACallout>
</GoAContainer>
</Sandbox>
</GoATab>

<GoATab
heading={
<>
Design guidelines
<GoABadge type="information" content="In progress" />
</>
}
>
<p>Coming Soon</p>
</GoATab>
</GoATabs>
</>
);
}
Loading

0 comments on commit 7320cac

Please sign in to comment.