diff --git a/packages/docs/pages/spacing.tsx b/packages/docs/pages/spacing.tsx index 5355d4d5b..d07035cdc 100644 --- a/packages/docs/pages/spacing.tsx +++ b/packages/docs/pages/spacing.tsx @@ -1,8 +1,8 @@ import { Box, Button, Flex, H1, Panel, Text } from '@bigcommerce/big-design'; -import React, { useContext } from 'react'; +import React, { Fragment, useContext } from 'react'; import styled, { ThemeContext } from 'styled-components'; -import { CodePreview, NextLink, PageNavigation } from '../components'; +import { Code, CodePreview, ContentRoutingTabs, List, NextLink } from '../components'; const BlueBox = styled(Box)(({ theme }) => ({ backgroundColor: theme.colors.primary, @@ -11,79 +11,90 @@ const BlueBox = styled(Box)(({ theme }) => ({ width: theme.spacing.large, })); -const StyledText = styled(Text)` - padding: 0; - margin: 0; -`; - const SpacingPage = () => { const { spacing } = useContext(ThemeContext); - const items = [ - { - id: 'examples', - title: 'Examples', - render: () => ( - <> - - - Spacing can be used directly on certain properties that expect a size value, like{' '} - Margin and Padding. - - - {/* jsx-to-string:start */} - <> - - - - {/* jsx-to-string:end */} - - - - You can also use spacing directly from the theme to style other components, for example: - - - {/* jsx-to-string:start */} - {function Example() { - const StyledBox = styled(Box)(({ theme }) => ({ - backgroundColor: theme.colors.primary, - height: theme.spacing.large, - width: theme.spacing.large, - })); - - return ; - }} - {/* jsx-to-string:end */} - - - - ), - }, - { - id: 'spacing', - title: 'Spacing values', - render: () => ( - - - {Object.keys(spacing) - .reverse() - .map((key) => ( - - {key} - - - ))} - - - ), - }, - ]; - return ( <>

Spacing

- + + + BigDesign core theme provides a pre-defined set of spacing values that are primarily used with any of the{' '} + padding and margin props. There are a few ways we can consume these + values. + + When to use: + + + Using the Margin and Padding props. + + Consuming it from the theme in a custom component. + + + + + ( + + + Certain components will include padding and margin props. + You can use the spacing keys to apply spacing values to those props. + + + {/* jsx-to-string:start */} + <> + + + + {/* jsx-to-string:end */} + + + ), + }, + { + id: 'style', + title: 'Applying to a style', + render: () => ( + + You can also use spacing directly from the theme to style other components. + + {/* jsx-to-string:start */} + {function Example() { + const StyledBox = styled(Box)(({ theme }) => ({ + backgroundColor: theme.colors.primary, + height: theme.spacing.large, + width: theme.spacing.large, + })); + + return ; + }} + {/* jsx-to-string:end */} + + + ), + }, + ]} + /> + + + + + {Object.keys(spacing) + .reverse() + .map((key) => ( + + {key} + + + ))} + + ); };