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

feat(docs): Update Link documentation page to use new layout #712

Merged
merged 3 commits into from
Feb 10, 2022
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
6 changes: 3 additions & 3 deletions packages/docs/pages/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const ButtonPage = () => {
id: 'basic',
title: 'Basic',
render: () => (
<>
<Fragment key="basic">
<Text>Buttons are calls to action used throughout the product experience.</Text>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot adding the key in here 😅

<CodePreview>
{/* jsx-to-string:start */}
Expand All @@ -52,7 +52,7 @@ const ButtonPage = () => {
</Button>
{/* jsx-to-string:end */}
</CodePreview>
</>
</Fragment>
),
},
{
Expand Down Expand Up @@ -80,7 +80,7 @@ const ButtonPage = () => {
},
{
id: 'action-types',
title: 'Action Types',
title: 'Action types',
render: () => (
<Fragment key="action-types">
<Text>
Expand Down
112 changes: 72 additions & 40 deletions packages/docs/pages/link.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,84 @@
import { H1, Link, Panel, Text } from '@bigcommerce/big-design';
import React from 'react';
import React, { Fragment } from 'react';

import { CodePreview, PageNavigation } from '../components';
import { Code, CodePreview, ContentRoutingTabs, GuidelinesTable, List } from '../components';
import { LinkPropTable, MarginPropTable } from '../PropTables';

const LinkPage = () => {
const items = [
{
id: 'examples',
title: 'Examples',
render: () => (
<>
<Panel>
<Text>
A simple wrapper for anchor elements. Use instead of {'<a>'}. Supports all native anchor element
attributes.
</Text>
<CodePreview>
{/* jsx-to-string:start */}
<Link href="#">Link Example</Link>
{/* jsx-to-string:end */}
</CodePreview>
</Panel>
<Panel header="External link">
<Text>You can also include and external icon.</Text>
<CodePreview>
{/* jsx-to-string:start */}
<Link href="#" target="_blank" external>
Learn More
</Link>
{/* jsx-to-string:end */}
</CodePreview>
</Panel>
</>
),
},
{
id: 'props',
title: 'Props',
render: () => <LinkPropTable inheritedProps={<MarginPropTable collapsible />} />,
},
];

return (
<>
<H1>Link</H1>

<PageNavigation items={items} />
<Panel header="Overview" headerId="overview">
<Text>Provides navigation to another page</Text>
<Text bold>When to use:</Text>
<List>
<List.Item>Navigate to an external webpage</List.Item>
<List.Item>Navigate to helpful documentation</List.Item>
</List>
</Panel>

<Panel header="Implementation" headerId="implementation">
<ContentRoutingTabs
id="implementation"
routes={[
{
id: 'basic',
title: 'Basic',
render: () => (
<Fragment key="basic">
<Text>
A simple wrapper for anchor elements. Use instead of {'<a>'}. Supports all native anchor element
attributes.
</Text>
<CodePreview>
{/* jsx-to-string:start */}
<Link href="#">Link example</Link>
{/* jsx-to-string:end */}
</CodePreview>
</Fragment>
),
},
{
id: 'external-link',
title: 'External link',
render: () => (
<Fragment key="external-link">
<Text>You can also include an external icon.</Text>
<CodePreview>
{/* jsx-to-string:start */}
<Link href="#" target="_blank" external>
Learn more
</Link>
{/* jsx-to-string:end */}
</CodePreview>
</Fragment>
),
},
]}
/>
</Panel>

<Panel header="Props" headerId="props">
<LinkPropTable
inheritedProps={<MarginPropTable collapsible />}
renderPanel={false}
nativeElement={['a', 'all']}
/>
</Panel>

<Panel header="Do's and Don'ts" headerId="guidelines">
<GuidelinesTable
recommended={[
<>
Use the <Code primary>external</Code> prop when a link navigates away from the control panel.
</>,
<>Usually within a sentence to provide additional guidance or information.</>,
<>Use descriptive text to set clear expectations of the link destination.</>,
]}
discouraged={[<>Avoid using links for actions – use a button instead.</>]}
/>
</Panel>
</>
);
};
Expand Down