From ec6ac35c052f6775f01ecff60bfd433764a0cef0 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Thu, 2 Apr 2020 17:06:16 +0200 Subject: [PATCH] doc: Add components examples --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 188b408..323b63a 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ Design System for React, based on Chakra UI + Next.js, written in TypeScript. - Low-boilerplate `_app.tsx` - Batteries included but replaceable (theme, colors, fonts) -- Components: - - Links - - Containers - - More to come - 100% TypeScript +- Components: + - 🔗 [Links](#links) + - 🗜 [Containers](#containers) + - 🧪 _More to come_ ## Installation @@ -113,6 +113,61 @@ export default createChakraNextApp({ }) ``` +## Components + +### Links + +```tsx +import { RouteLink, OutgoingLink, ButtonRouteLink } from '@47ng/chakra-next' + +export default () => ( + <> + {/* Integrate Next.js routes with Chakra styles */} + Login + + {/* Use `as` for dynamic routes */} + Login + + {/* Make external links stand out */} + GitHub + + {/* For when a button looks better, still outputs an tag */} + Logout + +) +``` + +### Containers + +```tsx +import { Container, FlexContainer, StackContainer } from '@47ng/chakra-next' + +export default () => ( + <> + {/* Container as Box */} + I am centred and width-limited + + {/* Container + Flex */} + + Direction is column by default + Foo + Bar + Egg + + + {/* Container + Stack */} + + Foo + Bar + Egg + + + + {/* All containers can be wider */} + I am centred and width-limited +) +``` + ## License [MIT](https://github.com/47ng/chakra-next/blob/next/LICENSE) - Made with ❤️ by [François Best](https://francoisbest.com).