From f7485448f13b84d4ebcb67df46c9dd66fb51c9c1 Mon Sep 17 00:00:00 2001 From: Chancellor Clark Date: Thu, 8 Aug 2019 13:54:55 -0500 Subject: [PATCH] feat(docs): panel documentation (#137) * feat(docs): panel documentation * Update packages/docs/pages/Panel/PanelPage.tsx Co-Authored-By: Daniel Almaguer --- packages/docs/PropTables/PanelPropTable.tsx | 12 ++ packages/docs/PropTables/index.ts | 1 + .../docs/components/Collapsible/index.tsx | 18 ++- .../docs/components/Collapsible/styled.tsx | 1 + packages/docs/pages/Panel/PanelPage.tsx | 107 ++++++++++-------- packages/docs/pages/_app.tsx | 2 +- 6 files changed, 87 insertions(+), 54 deletions(-) create mode 100644 packages/docs/PropTables/PanelPropTable.tsx diff --git a/packages/docs/PropTables/PanelPropTable.tsx b/packages/docs/PropTables/PanelPropTable.tsx new file mode 100644 index 000000000..3d6c0bb81 --- /dev/null +++ b/packages/docs/PropTables/PanelPropTable.tsx @@ -0,0 +1,12 @@ +import { Text } from '@bigcommerce/big-design'; +import React from 'react'; + +import { Code } from '../components'; + +export const PanelPropTable: React.FC = () => ( + + A Panel can use all Box props, besides backgroundColor,{' '} + shadow, and any padding props. Otherwise, supports all native{' '} + <div /> element attributes. + +); diff --git a/packages/docs/PropTables/index.ts b/packages/docs/PropTables/index.ts index 6b77f08f4..e84afc21c 100644 --- a/packages/docs/PropTables/index.ts +++ b/packages/docs/PropTables/index.ts @@ -11,6 +11,7 @@ export * from './InputPropTable'; export * from './MarginPropTable'; export * from './ModalPropTable'; export * from './PaddingPropTable'; +export * from './PanelPropTable'; export * from './RadioPropTable'; export * from './SelectPropTable'; export * from './TabsPropTable'; diff --git a/packages/docs/components/Collapsible/index.tsx b/packages/docs/components/Collapsible/index.tsx index cfa19653b..0efff1a02 100644 --- a/packages/docs/components/Collapsible/index.tsx +++ b/packages/docs/components/Collapsible/index.tsx @@ -12,14 +12,26 @@ export const Collapsible: React.FC = ({ children, title }) => const [isCollapsed, setCollapsed] = useState(true); const toggleIsCollapsed = () => setCollapsed(!isCollapsed); + const handleKeyPressed = e => { + if (e.key === 'Enter' || e.key === ' ') { + toggleIsCollapsed(); + } + }; + return ( - <> - +
+ {isCollapsed ? : } {title} {!isCollapsed && children} - +
); }; diff --git a/packages/docs/components/Collapsible/styled.tsx b/packages/docs/components/Collapsible/styled.tsx index 8d620aac5..a2e625dab 100644 --- a/packages/docs/components/Collapsible/styled.tsx +++ b/packages/docs/components/Collapsible/styled.tsx @@ -3,4 +3,5 @@ import styled from 'styled-components'; export const StyledFlex = styled(Flex)` cursor: pointer; + display: inline-flex; `; diff --git a/packages/docs/pages/Panel/PanelPage.tsx b/packages/docs/pages/Panel/PanelPage.tsx index eeb1f067c..70845f82d 100644 --- a/packages/docs/pages/Panel/PanelPage.tsx +++ b/packages/docs/pages/Panel/PanelPage.tsx @@ -1,54 +1,61 @@ -import { Box, Button, Flex, H2, Panel, Text } from '@bigcommerce/big-design'; +import { Button, Flex, H0, H1, H2, Link, Panel, Text } from '@bigcommerce/big-design'; import React from 'react'; +import { CodePreview, Collapsible } from '../../components'; +import { BoxPropTable, MarginPropTable, PanelPropTable } from '../../PropTables'; + export default () => ( - - - -

Panel header - h2

- -
- Text -p -
- - -

Panel header - h2

- Text -p -
- - - -

Panel header - h2

- -
- - Occaecat eiusmod elit laboris pariatur aute esse dolore nostrud ipsum laboris qui. Reprehenderit exercitation - nisi consectetur deserunt tempor fugiat sunt eiusmod consectetur nisi magna. Consequat aute magna aliquip - deserunt in magna labore cillum nisi aliquip sit irure anim exercitation. - - - Eu occaecat mollit laborum pariatur pariatur excepteur. Voluptate eiusmod ea sit ad deserunt dolore consectetur - nulla veniam in est aliquip anim adipisicing. Aute sit est mollit commodo qui et anim eu officia proident et. - Deserunt ipsum et cupidatat magna consectetur aute ad fugiat enim fugiat. Nisi nisi labore anim occaecat non - aliqua dolor sit nostrud. Do nulla enim proident proident. Fugiat consectetur culpa exercitation veniam culpa - Lorem irure. - -
- - -

Panel header - h2

- - Occaecat eiusmod elit laboris pariatur aute esse dolore nostrud ipsum laboris qui. Reprehenderit exercitation - nisi consectetur deserunt tempor fugiat sunt eiusmod consectetur nisi magna. Consequat aute magna aliquip - deserunt in magna labore cillum nisi aliquip sit irure anim exercitation. - - - Eu occaecat mollit laborum pariatur pariatur excepteur. Voluptate eiusmod ea sit ad deserunt dolore consectetur - nulla veniam in est aliquip anim adipisicing. Aute sit est mollit commodo qui et anim eu officia proident et. - Deserunt ipsum et cupidatat magna consectetur aute ad fugiat enim fugiat. Nisi nisi labore anim occaecat non - aliqua dolor sit nostrud. Do nulla enim proident proident. Fugiat consectetur culpa exercitation veniam culpa - Lorem irure. - -
-
+ <> + Panels + + + The panel component is used to contain content in a structured format.{' '} + Panel Design Guidlines + + + + {/* jsx-to-string:start */} + + + +

Panel header

+
+ + + +
+ + Lorem ipsum dolor amet officia humblebrag selvage, subway tile vexillologist id pickled adaptogen fashion axe. + Ennui meh pitchfork banh mi. Keffiyeh PBRB echo park gastropub. Pop-up neutra brunch ullamco affogato shaman + vexillologist quinoa post-ironic locavore. Retro selfies proident synth ethical quinoa marfa chartreuse dolor + vexillologist gochujang. Tempor poke unicorn, readymade crucifix fugiat culpa. Kinfolk hella asymmetrical, + meggings et consectetur lomo farm-to-table exercitation DIY. + + + Leggings consectetur heirloom, sustainable 90's scenester sartorial sint meditation portland health goth + bespoke gastropub authentic. Flannel iceland narwhal, laborum adaptogen paleo glossier reprehenderit. Ethical + ugh copper mug voluptate brooklyn velit 3 wolf moon tacos. Bushwick vexillologist air plant, veniam jianbing + poke semiotics wayfarers. Typewriter single-origin coffee cray, thundercats asymmetrical succulents green + juice irure cred taxidermy celiac. + +
+ {/* jsx-to-string:end */} +
+ +

API

+ +

Panel

+ + + +

Inherited Props

+ + + + + + + + + ); diff --git a/packages/docs/pages/_app.tsx b/packages/docs/pages/_app.tsx index 8f7fcc298..c2faf2a28 100644 --- a/packages/docs/pages/_app.tsx +++ b/packages/docs/pages/_app.tsx @@ -47,7 +47,7 @@ export default class MyApp extends App { gridArea="main" marginVertical="medium" marginHorizontal="xxLarge" - style={{ maxWidth: '100%', overflow: 'hidden' }} + style={{ maxWidth: '100%' }} >