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): getting started page #125

Merged
merged 1 commit into from
Aug 5, 2019
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<a href="https://bigcommerce.design/bigdesign">
<img alt="BigDesign" src="https://bigcommerce.github.io/big-design/logo.svg" width="546">
<img alt="BigDesign" src="https://bigcommerce.github.io/big-design/logo-with-text.svg" width="546">
</a>
</div>

Expand Down
6 changes: 4 additions & 2 deletions packages/docs/components/CodeSnippet/CodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CodeEditorThemeContext } from '../StoryWrapper/StoryWrapper';

interface EditorProps {
language?: string;
showControls?: boolean;
}

function formatCode(code: string) {
Expand Down Expand Up @@ -38,13 +39,13 @@ function getCode(children: React.ReactNode) {
}

export const CodeSnippet: React.FC<EditorProps> = props => {
const { children, language } = props;
const { children, language, showControls } = props;
const { editorTheme } = useContext(CodeEditorThemeContext);
const code = getCode(children);

return (
<Box border="box" marginBottom="xxLarge">
<SnippetControls copyToClipboard={() => clipboardCopy(code)} helperText="Code example" />
{showControls && <SnippetControls copyToClipboard={() => clipboardCopy(code)} helperText="Code example" />}

{/* react-live Editor types are wrong, PR submitted */}
{/*
Expand All @@ -56,4 +57,5 @@ export const CodeSnippet: React.FC<EditorProps> = props => {

CodeSnippet.defaultProps = {
language: 'jsx',
showControls: true,
};
6 changes: 4 additions & 2 deletions packages/docs/components/SideNav/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { SideNavLink } from './SideNavLink';
export const SideNav: React.FC = () => {
return (
<StyledFlex flexDirection="column" padding="medium" paddingBottom="xxxLarge" backgroundColor="white">
<img src="/static/logo.svg" alt="BigDesign Logo" />
<img src="/static/logo-with-text.svg" alt="BigDesign Logo" />

<SideNavGroup title="Foundation">
<SideNavLink href="/">Getting Started</SideNavLink>
<SideNavLink href="/GettingStarted/GettingStartedPage" as="/">
Getting Started
</SideNavLink>
<SideNavLink href="/Colors/ColorsPage" as="/colors">
Colors
</SideNavLink>
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
return config;
},
exportPathMap: () => ({
'/': { page: '/' },
'/': { page: '/GettingStarted/GettingStartedPage' },
'/badge': { page: '/Badge/BadgePage' },
'/box': { page: '/Box/BoxPage' },
'/button': { page: '/Button/ButtonPage' },
Expand Down
87 changes: 87 additions & 0 deletions packages/docs/pages/GettingStarted/GettingStartedPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { Flex, H1, H2, Link, Text } from '@bigcommerce/big-design';
import React from 'react';

import { Code, CodeSnippet, List } from '../../components';

export default () => (
<Flex flexDirection="column">
<figure style={{ textAlign: 'center' }}>
<img src="/static/logo.svg" alt="BigDesign Logo" style={{ width: 200 }} />
</figure>

<Flex.Item alignSelf="center">
<H1>BigDesign Component Playground</H1>
</Flex.Item>

<Text>
Our design language system and React component library was built to enable designers and developers to build
experiences that seamlessly integrate with the BigCommerce product ecosystem.
</Text>

<H2>Getting Started</H2>

<Text>Add BigDesign and styled-components to your project:</Text>
<CodeSnippet showControls={false} language="bash">
npm install @bigcommerce/big-design styled-components
</CodeSnippet>

<Text>
Import the <Code>GlobalStyles</Code> component and use it once in your app. This will set a few styles globally,
including a base font family,{' '}
<Link href="https://fonts.google.com/specimen/Source+Sans+Pro" target="_blank">
Source Sans Pro
</Link>{' '}
and{' '}
<Link href="https://github.com/necolas/normalize.css/" target="_blank">
normalize.css
</Link>
. We recommend placing it close to your root component. Then import any component, such as <Code>Button</Code>, to
use it anywhere in your app.
</Text>

<CodeSnippet>
{`
import { Button, GlobalStyles } from '@bigcommerce/big-design';

// ...

<App>
<GlobalStyles />
<Button>Click me</Button>
</App>
`}
</CodeSnippet>

<H2 marginBottom="none">Helpful Resources</H2>
<List>
<List.Item>
<Link href="https://bigcommerce.design/components" target="_blank">
Design Guidelines
</Link>
</List.Item>
<List.Item>
<Link href="https://github.com/bigcommerce/big-design" target="_blank">
Components GitHub Repo
</Link>
</List.Item>
<List.Item>
<Link href="https://github.com/bigcommerce-labs/sample-plab-app" target="_blank">
Sample App
</Link>
</List.Item>
<List.Item>
<Link href="#">BigDesign Dev Blog Demo</Link>
</List.Item>
<List.Item>
<Link href="https://support.bigcommerce.com/s/group/0F91B000000bnqoSAA/bigdesign-beta" target="_blank">
Community Beta Group
</Link>
</List.Item>
<List.Item>
<Link href="https://developer.bigcommerce.com" target="_blank">
Dev Center
</Link>
</List.Item>
</List>
</Flex>
);
4 changes: 0 additions & 4 deletions packages/docs/pages/index.tsx

This file was deleted.

1 change: 1 addition & 0 deletions packages/docs/static/logo-with-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading