From 92ead5ae60ae948840d0d72fabc76c501c687416 Mon Sep 17 00:00:00 2001 From: Pedro Nauck Date: Sat, 16 Jun 2018 22:48:45 -0300 Subject: [PATCH] feat(docz-example-babel6): add package --- examples/babel6/.babelrc | 5 + examples/babel6/CHANGELOG.md | 222 ++++++++++++++++++++++ examples/babel6/doczrc.js | 5 + examples/babel6/package.json | 22 +++ examples/babel6/src/components/Alert.jsx | 30 +++ examples/babel6/src/components/Alert.mdx | 40 ++++ examples/babel6/src/components/Button.jsx | 77 ++++++++ examples/babel6/src/components/Button.mdx | 57 ++++++ examples/babel6/src/index.mdx | 21 ++ 9 files changed, 479 insertions(+) create mode 100644 examples/babel6/.babelrc create mode 100644 examples/babel6/CHANGELOG.md create mode 100644 examples/babel6/doczrc.js create mode 100644 examples/babel6/package.json create mode 100644 examples/babel6/src/components/Alert.jsx create mode 100644 examples/babel6/src/components/Alert.mdx create mode 100644 examples/babel6/src/components/Button.jsx create mode 100644 examples/babel6/src/components/Button.mdx create mode 100644 examples/babel6/src/index.mdx diff --git a/examples/babel6/.babelrc b/examples/babel6/.babelrc new file mode 100644 index 000000000..138b5ccce --- /dev/null +++ b/examples/babel6/.babelrc @@ -0,0 +1,5 @@ +{ + "plugins": [ + "emotion" + ] +} diff --git a/examples/babel6/CHANGELOG.md b/examples/babel6/CHANGELOG.md new file mode 100644 index 000000000..ea77bab4d --- /dev/null +++ b/examples/babel6/CHANGELOG.md @@ -0,0 +1,222 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +## [0.2.5](https://github.com/pedronauck/docz/compare/v0.2.4...v0.2.5) (2018-06-15) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.2.4](https://github.com/pedronauck/docz/compare/v0.2.3...v0.2.4) (2018-06-13) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.2.3](https://github.com/pedronauck/docz/compare/v0.2.2...v0.2.3) (2018-06-13) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.2.2](https://github.com/pedronauck/docz/compare/v0.2.1...v0.2.2) (2018-06-12) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.2.1](https://github.com/pedronauck/docz/compare/v0.2.0...v0.2.1) (2018-06-12) + + + + +**Note:** Version bump only for package docz-example-basic + + +# [0.2.0](https://github.com/pedronauck/docz/compare/v0.2.0-beta.2...v0.2.0) (2018-06-11) + + + + +**Note:** Version bump only for package docz-example-basic + + +# [0.2.0-beta.2](https://github.com/doczjs/docz/compare/v0.2.0-beta.1...v0.2.0-beta.2) (2018-06-10) + + +### Bug Fixes + +* **docz-core:** autolink headings ([0b8369d](https://github.com/doczjs/docz/commit/0b8369d)) + + + + + +# [0.2.0-beta.1](https://github.com/doczjs/docz/compare/v0.2.0-beta.0...v0.2.0-beta.1) (2018-06-10) + + + + +**Note:** Version bump only for package docz-example-basic + + +# [0.2.0-beta.0](https://github.com/doczjs/docz/compare/v0.1.2-beta.6...v0.2.0-beta.0) (2018-06-10) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.6](https://github.com/doczjs/docz/compare/v0.1.2-beta.5...v0.1.2-beta.6) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.5](https://github.com/doczjs/docz/compare/v0.1.2-beta.4...v0.1.2-beta.5) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.4](https://github.com/doczjs/docz/compare/v0.1.2-beta.3...v0.1.2-beta.4) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.3](https://github.com/doczjs/docz/compare/v0.1.2-beta.2...v0.1.2-beta.3) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.2](https://github.com/doczjs/docz/compare/v0.1.2-beta.1...v0.1.2-beta.2) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.1](https://github.com/doczjs/docz/compare/v0.1.2-beta.0...v0.1.2-beta.1) (2018-06-09) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.2-beta.0](https://github.com/doczjs/docz/compare/v0.1.1...v0.1.2-beta.0) (2018-06-02) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.6](https://github.com/doczjs/docz/compare/v0.1.1-beta.5...v0.1.1-beta.6) (2018-06-01) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.5](https://github.com/doczjs/docz/compare/v0.1.1-beta.4...v0.1.1-beta.5) (2018-06-01) + + +### Bug Fixes + +* **load-cfg:** add namedExports options ([d36194d](https://github.com/doczjs/docz/commit/d36194d)) + + + + + +## [0.1.1-beta.4](https://github.com/doczjs/docz/compare/v0.1.1-beta.3...v0.1.1-beta.4) (2018-05-29) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.3](https://github.com/doczjs/docz/compare/v0.1.1-beta.2...v0.1.1-beta.3) (2018-05-29) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.2](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.2) (2018-05-29) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.1](https://github.com/doczjs/docz/compare/v0.1.1-beta.0...v0.1.1-beta.1) (2018-05-29) + + + + +**Note:** Version bump only for package docz-example-basic + + +## [0.1.1-beta.0](https://github.com/doczjs/docz/compare/v0.1.0...v0.1.1-beta.0) (2018-05-29) + + + + +**Note:** Version bump only for package docz-example-basic + + +# 0.1.0 (2018-05-29) + + +### Bug Fixes + +* **docz-core:** config watch for directory operations ([43fa7ab](https://github.com/doczjs/docz/commit/43fa7ab)) +* **docz-core:** create plugin to fix paragraph parse on mdx ([42b4f05](https://github.com/doczjs/docz/commit/42b4f05)) +* **docz-core:** packages splitting ([d2e74ee](https://github.com/doczjs/docz/commit/d2e74ee)) +* **docz-example-basic:** package name ([dec5713](https://github.com/doczjs/docz/commit/dec5713)) + + +### Features + +* **docz:** add groups feature ([9652b30](https://github.com/doczjs/docz/commit/9652b30)) +* add basic monorepo structure ([5a977ed](https://github.com/doczjs/docz/commit/5a977ed)) +* **docz:** add components parser ([a4127d9](https://github.com/doczjs/docz/commit/a4127d9)) +* **docz:** add custom routes for docs ([8458d91](https://github.com/doczjs/docz/commit/8458d91)) +* **docz-core:** add build command ([ef7abd2](https://github.com/doczjs/docz/commit/ef7abd2)) +* **docz-core:** add hot reload ([9ebe65d](https://github.com/doczjs/docz/commit/9ebe65d)) +* **docz-core:** add playground code parse section ([6bbf158](https://github.com/doczjs/docz/commit/6bbf158)) +* **docz-core:** set babel on the fly ([672be49](https://github.com/doczjs/docz/commit/672be49)) +* add component props parse feature ([987627d](https://github.com/doczjs/docz/commit/987627d)) +* add support for highlight code sections ([19bf7ea](https://github.com/doczjs/docz/commit/19bf7ea)) +* **docz-core:** use websockets instead of generate json to process entries ([e0773a0](https://github.com/doczjs/docz/commit/e0773a0)) +* **docz-theme-default:** start logic to create theme feature ([900cf2b](https://github.com/doczjs/docz/commit/900cf2b)) +* refac to use mdx ([04b59e5](https://github.com/doczjs/docz/commit/04b59e5)) diff --git a/examples/babel6/doczrc.js b/examples/babel6/doczrc.js new file mode 100644 index 000000000..3dcb76ca0 --- /dev/null +++ b/examples/babel6/doczrc.js @@ -0,0 +1,5 @@ +import { babel } from 'docz-plugin-babel6' + +export default { + plugins: [babel()], +} diff --git a/examples/babel6/package.json b/examples/babel6/package.json new file mode 100644 index 000000000..9cd422c32 --- /dev/null +++ b/examples/babel6/package.json @@ -0,0 +1,22 @@ +{ + "name": "docz-example-babel6", + "version": "0.2.5", + "license": "MIT", + "scripts": { + "dev": "docz dev", + "build": "docz build" + }, + "dependencies": { + "docz": "^0.2.5", + "docz-core": "^0.2.4", + "emotion": "^9.2.1", + "prop-types": "^15.6.1", + "react": "^16.4.0", + "react-dom": "^16.4.0", + "react-emotion": "^9.2.1" + }, + "devDependencies": { + "babel-plugin-emotion": "^9.2.0", + "docz-plugin-babel6": "^0.2.4" + } +} diff --git a/examples/babel6/src/components/Alert.jsx b/examples/babel6/src/components/Alert.jsx new file mode 100644 index 000000000..1fbe8e9a2 --- /dev/null +++ b/examples/babel6/src/components/Alert.jsx @@ -0,0 +1,30 @@ +import React, { Fragment } from 'react' +import styled from 'react-emotion' +import t from 'prop-types' + +const kinds = { + info: '#5352ED', + positive: '#2ED573', + negative: '#FF4757', + warning: '#FFA502', +} + +const AlertStyled = styled('div')` + padding: 15px 20px; + background: white; + border-radius: 3px; + color: white; + background: ${({ kind = 'info' }) => kinds[kind]}; +` + +const Alert = props => + +Alert.propTypes = { + kind: t.oneOf(['info', 'positive', 'negative', 'warning']), +} + +Alert.defaultProps = { + kind: 'info', +} + +export default Alert diff --git a/examples/babel6/src/components/Alert.mdx b/examples/babel6/src/components/Alert.mdx new file mode 100644 index 000000000..3a9fafd0d --- /dev/null +++ b/examples/babel6/src/components/Alert.mdx @@ -0,0 +1,40 @@ +--- +name: Alert +menu: Components +--- + +import { Playground, PropsTable } from 'docz' +import Alert from './Alert' + +# Alert + +## Properties + + + +## Basic usage + + + Some message + + +## Using different kinds + + + Some message + Some message + Some message + Some message + + +## Use with children as a function + + + {() => { + const message = 'Hello world' + + return ( + {message} + ) + }} + diff --git a/examples/babel6/src/components/Button.jsx b/examples/babel6/src/components/Button.jsx new file mode 100644 index 000000000..17bf8373e --- /dev/null +++ b/examples/babel6/src/components/Button.jsx @@ -0,0 +1,77 @@ +import React from 'react' +import styled from 'react-emotion' +import t from 'prop-types' + +const scales = { + small: ` + padding: 5px 10px; + font-size: 14px; + `, + normal: ` + padding: 10px 20px; + font-size: 16px; + `, + big: ` + padding: 20px 30px; + font-size: 18px; + `, +} + +const kind = outline => (bg, color) => { + const boxShadowColor = outline ? bg : 'transparent' + const backgroundColor = outline ? 'transparent' : bg + + return ` + background: ${backgroundColor}; + box-shadow: inset 0 0 0 1px ${boxShadowColor}; + color: ${outline ? bg : color}; + transition: all .3s; + + &:hover { + box-shadow: inset 0 0 0 1000px ${boxShadowColor}; + color: ${color}; + } + ` +} + +const kinds = outline => { + const get = kind(outline) + + return { + primary: get('#1FB6FF', 'white'), + secondary: get('#5352ED', 'white'), + cancel: get('#FF4949', 'white'), + dark: get('#273444', 'white'), + gray: get('#8492A6', 'white'), + } +} + +const getScale = ({ scale = 'normal' }) => scales[scale] +const getKind = ({ kind = 'primary', outline = false }) => kinds(outline)[kind] + +const ButtonStyled = styled('button')` + ${getKind}; + ${getScale}; + cursor: pointer; + margin: 3px 5px; + border: none; + border-radius: 3px; +` + +const Button = ({ children, ...props }) => ( + {children} +) + +Button.propTypes = { + scales: t.oneOf(['small', 'normal', 'big']), + kind: t.oneOf(['primary', 'secondary', 'cancel', 'dark', 'gray']), + outline: t.bool, +} + +Button.defaultProps = { + scales: 'normal', + kind: 'primary', + outline: false, +} + +export default Button diff --git a/examples/babel6/src/components/Button.mdx b/examples/babel6/src/components/Button.mdx new file mode 100644 index 000000000..9bcac563f --- /dev/null +++ b/examples/babel6/src/components/Button.mdx @@ -0,0 +1,57 @@ +--- +name: Button +menu: Components +--- + +import { Playground, PropsTable } from 'docz' +import Button from './Button' + +# Button + +Buttons make common actions more obvious and help users more easily perform them. Buttons use labels and sometimes icons to communicate the action that will occur when the user touches them. + +### Best practices + +- Group buttons logically into sets based on usage and importance. +- Ensure that button actions are clear and consistent. +- The main action of a group set can be a primary button. +- Select a single button variation and do not mix them. + +## Properties + + + +## Basic usage + + + + + +## With different sizes + + + + + + + +## With different colors + + + + + + + + + +## Outlined + + + + + + + + + diff --git a/examples/babel6/src/index.mdx b/examples/babel6/src/index.mdx new file mode 100644 index 000000000..71f122bbb --- /dev/null +++ b/examples/babel6/src/index.mdx @@ -0,0 +1,21 @@ +--- +name: Getting Started +route: / +order: 1 +--- + +# Getting Started + +Design systems enable teams to build better products faster by making design reusable—reusability makes scale possible. This is the heart and primary value of design systems. A design system is a collection of reusable components, guided by clear standards, that can be assembled together to build any number of applications. + +Regardless of the technologies and tools behind them, a successful design system follows these guiding principles: + +- **It’s consistent**. The way components are built and managed follows a predictable pattern. +- **It’s self-contained**. Your design system is treated as a standalone dependency. +- **It’s reusable**. You’ve built components so they can be reused in many contexts. +- **It’s accessible**. Applications built with your design system are usable by as many people as possible, no matter how they access the web. +- **It’s robust**. No matter the product or platform to which your design system is applied, it should perform with grace and minimal bugs. + +## Consistency + +Your first, most important task when starting out is to define the rules of your system, document them, and ensure that everyone follows them. When you have clearly documented code standards and best practices in place, designers and developers from across your organization can easily use and, more importantly, contribute to your design system.