diff --git a/.changeset/poor-wolves-burn.md b/.changeset/poor-wolves-burn.md new file mode 100644 index 0000000000..a1e1835da1 --- /dev/null +++ b/.changeset/poor-wolves-burn.md @@ -0,0 +1,5 @@ +--- +'@commercetools-website/components-playground': minor +--- + +Add a playground example for drawer component to be used for drawer documentation. diff --git a/website-components-playground/src/application.tsx b/website-components-playground/src/application.tsx index 96e0063896..0822b148cd 100644 --- a/website-components-playground/src/application.tsx +++ b/website-components-playground/src/application.tsx @@ -17,6 +17,8 @@ const FormDetailPage = lazy(() => import('./pages/form-detail-page')); const FormMainPage = lazy(() => import('./pages/form-main-page')); const FormModalPage = lazy(() => import('./pages/form-modal-page')); +const Drawer = lazy(() => import('./pages/drawer')); + const CustomFormDetailPage = lazy( () => import('./pages/custom-form-detail-page') ); @@ -79,6 +81,9 @@ const Application = () => ( + + + diff --git a/website-components-playground/src/pages/drawer.tsx b/website-components-playground/src/pages/drawer.tsx new file mode 100644 index 0000000000..735716e9cc --- /dev/null +++ b/website-components-playground/src/pages/drawer.tsx @@ -0,0 +1,83 @@ +import { Drawer } from '@commercetools-frontend/application-components'; +import Spacings from '@commercetools-uikit/spacings'; +import Text from '@commercetools-uikit/text'; +import ModalController from '../components/modal-controller'; +import PlaygroundController from '../components/playground-controller'; +import LayoutApp from '../layouts/layout-app'; + +const DrawerExample = () => ( + + + {({ values }) => ( + + {({ isOpen, setIsOpen }) => ( + setIsOpen(false)} + hideControls={values.hideControls === 'true'} + onPrimaryButtonClick={() => setIsOpen(false)} + onSecondaryButtonClick={() => setIsOpen(false)} + > + + {(values.content as string).split('\n').map((text, index) => ( + {text} + ))} + + + )} + + )} + + +); +DrawerExample.displayName = 'DrawerExample'; + +export default DrawerExample; diff --git a/website-components-playground/src/pages/index.tsx b/website-components-playground/src/pages/index.tsx index 4fccdac2f8..344c7bdb6e 100644 --- a/website-components-playground/src/pages/index.tsx +++ b/website-components-playground/src/pages/index.tsx @@ -40,6 +40,9 @@ const Application = () => (
  • {''}
  • +
  • + {''} +
  • );