Skip to content

Commit

Permalink
docs(patterns): add documentation for Page component (#1529)
Browse files Browse the repository at this point in the history
* docs(patterns): add documentation for Page component

* docs(patterns): add Page with Message sample

* docs(patterns): add side nav link and changeset

* docs(patterns): fix background props formatting
  • Loading branch information
davelinke authored Sep 10, 2024
1 parent 8d80893 commit 7b4f5a5
Show file tree
Hide file tree
Showing 5 changed files with 447 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-melons-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bigcommerce/docs': patch
---

Added Page pattern component documentation
106 changes: 106 additions & 0 deletions packages/docs/PropTables/PagePropTable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React from 'react';

import { Code, NextLink, Prop, PropTable, PropTableWrapper } from '../components';

const pageProps: Prop[] = [
{
name: 'header',
types: <NextLink href="/header">Header</NextLink>,
description: (
<>
Pass in an optional <NextLink href="/header">Header</NextLink> component for displaying the
page title and description.
</>
),
},
{
name: 'message',
types: <NextLink href="/message?props=inline-message">MessageProps</NextLink>,
description: (
<>
An optional <Code primary>Message</Code> component for displaying alerts or notifications.
</>
),
},
{
name: 'background',
types: (
<NextLink href={{ hash: 'props', query: { props: 'background-props' } }}>Background</NextLink>
),
description: 'The background settings for the page, determining background color or image.',
},
{
name: 'actionBar',
types: <NextLink href="/action-bar">ActionBar</NextLink>,
description: (
<>
Pass in an optional <NextLink href="/action-bar">ActionBar</NextLink> component for
displaying action buttons at the bottom.
</>
),
},
];

export const PagePropsTable: React.FC<PropTableWrapper> = (props) => (
<PropTable propList={pageProps} title="Page" {...props} />
);

const backgroundProps: Prop[] = [
{
name: 'src',
types: 'string',
description: 'The URL of the background image.',
required: true,
},
{
name: 'backgroundSize',
types: ['auto', 'length', 'cover', 'contain', 'initial', 'inherit'],
defaultValue: 'contain',
description: (
<>
Defines the size of the background image. Same as the{' '}
<Code highlight={false}>background-size</Code> CSS property.
</>
),
},
{
name: 'backgroundPosition',
types: [
'left top',
'left center',
'left bottom',
'right top',
'right center',
'right bottom',
'center top',
'center center',
'center bottom',
'x% y%',
'x-pos y-pos',
'initial',
'inherit',
],
defaultValue: 'top right',
description: (
<>
Sets the position of the background image. Same as the{' '}
<Code highlight={false}>background-position</Code> CSS property.
</>
),
},
{
name: 'backgroundRepeat',
defaultValue: 'no-repeat',
types: ['repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'],
description: (
<>
Specifies if/how the background image repeats. Same as the{' '}
<Code highlight={false}>background-repeat</Code> CSS property.
</>
),
},
];

export const BackgroundPropsTable: React.FC<PropTableWrapper> = (props) => (
<PropTable propList={backgroundProps} title="Page[Background]" {...props} />
);
1 change: 1 addition & 0 deletions packages/docs/components/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const SideNav: React.FC = () => {
<SideNavGroup title="Patterns">
<SideNavLink href="/action-bar">Action Bar</SideNavLink>
<SideNavLink href="/header">Header</SideNavLink>
<SideNavLink href="/page">Page</SideNavLink>
</SideNavGroup>

<SideNavGroup title="Utilities">
Expand Down
Loading

0 comments on commit 7b4f5a5

Please sign in to comment.