-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docz-plugin-css): add initial version (#78)
* fix(docz-core): reduce from plugins arguments * feat(docz-plugin-css): add initial version of plugin * chore(docz-plugin-css): add some examples
- Loading branch information
1 parent
bc0b7e0
commit 299372e
Showing
39 changed files
with
1,982 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { css } from 'docz-plugin-css' | ||
|
||
export default { | ||
plugins: [ | ||
css({ | ||
preprocessor: 'less', | ||
cssmodules: true, | ||
}), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "docz-example-css-less", | ||
"version": "0.2.9", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "docz dev", | ||
"build": "docz build" | ||
}, | ||
"dependencies": { | ||
"classnames": "^2.2.6", | ||
"docz": "^0.2.9", | ||
"docz-core": "^0.2.9", | ||
"prop-types": "^15.6.2", | ||
"react": "^16.4.1", | ||
"react-dom": "^16.4.1" | ||
}, | ||
"devDependencies": { | ||
"docz-plugin-css": "^0.2.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { Fragment } from 'react' | ||
import cx from 'classnames' | ||
import t from 'prop-types' | ||
|
||
import styles from './Alert.module.less' | ||
|
||
export const Alert = ({ children, kind }) => ( | ||
<div | ||
className={cx(styles.alert, { | ||
[styles[kind]]: true, | ||
})} | ||
> | ||
{children} | ||
</div> | ||
) | ||
|
||
Alert.propTypes = { | ||
kind: t.oneOf(['info', 'positive', 'negative', 'warning']), | ||
} | ||
|
||
Alert.defaultProps = { | ||
kind: 'info', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
name: Alert | ||
menu: Components | ||
--- | ||
|
||
import './index.less' | ||
import { Playground, PropsTable } from 'docz' | ||
import { Alert } from './Alert' | ||
|
||
# Alert | ||
|
||
## Properties | ||
|
||
<PropsTable of={Alert} /> | ||
|
||
## Basic usage | ||
|
||
<Playground> | ||
<Alert>Some message</Alert> | ||
</Playground> | ||
|
||
## Using different kinds | ||
|
||
<Playground> | ||
<Alert kind="info">Some message</Alert> | ||
<Alert kind="positive">Some message</Alert> | ||
<Alert kind="negative">Some message</Alert> | ||
<Alert kind="warning">Some message</Alert> | ||
</Playground> | ||
|
||
## Use with children as a function | ||
|
||
<Playground> | ||
{() => { | ||
const message = 'Hello world' | ||
|
||
return ( | ||
<Alert>{message}</Alert> | ||
) | ||
}} | ||
</Playground> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.alert { | ||
padding: 15px 20px; | ||
background: white; | ||
border-radius: 3px; | ||
color: white; | ||
} | ||
|
||
.info { | ||
background: #5352ED; | ||
} | ||
|
||
.positive { | ||
background: #2ED573; | ||
} | ||
|
||
.negative { | ||
background: #FF4757; | ||
} | ||
|
||
.warning { | ||
background: #FFA502; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { css } from 'docz-plugin-css' | ||
|
||
export default { | ||
plugins: [ | ||
css({ | ||
preprocessor: 'stylus', | ||
cssmodules: true, | ||
}), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "docz-example-css-postcss", | ||
"version": "0.2.9", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "docz dev", | ||
"build": "docz build" | ||
}, | ||
"dependencies": { | ||
"classnames": "^2.2.6", | ||
"docz": "^0.2.9", | ||
"docz-core": "^0.2.9", | ||
"prop-types": "^15.6.2", | ||
"react": "^16.4.1", | ||
"react-dom": "^16.4.1" | ||
}, | ||
"devDependencies": { | ||
"docz-plugin-css": "^0.2.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { Fragment } from 'react' | ||
import cx from 'classnames' | ||
import t from 'prop-types' | ||
|
||
import styles from './Alert.module.css' | ||
|
||
export const Alert = ({ children, kind }) => ( | ||
<div | ||
className={cx(styles.alert, { | ||
[styles[kind]]: true, | ||
})} | ||
> | ||
{children} | ||
</div> | ||
) | ||
|
||
Alert.propTypes = { | ||
kind: t.oneOf(['info', 'positive', 'negative', 'warning']), | ||
} | ||
|
||
Alert.defaultProps = { | ||
kind: 'info', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
name: Alert | ||
menu: Components | ||
--- | ||
|
||
import './index.css' | ||
import { Playground, PropsTable } from 'docz' | ||
import { Alert } from './Alert' | ||
|
||
# Alert | ||
|
||
## Properties | ||
|
||
<PropsTable of={Alert} /> | ||
|
||
## Basic usage | ||
|
||
<Playground> | ||
<Alert>Some message</Alert> | ||
</Playground> | ||
|
||
## Using different kinds | ||
|
||
<Playground> | ||
<Alert kind="info">Some message</Alert> | ||
<Alert kind="positive">Some message</Alert> | ||
<Alert kind="negative">Some message</Alert> | ||
<Alert kind="warning">Some message</Alert> | ||
</Playground> | ||
|
||
## Use with children as a function | ||
|
||
<Playground> | ||
{() => { | ||
const message = 'Hello world' | ||
|
||
return ( | ||
<Alert>{message}</Alert> | ||
) | ||
}} | ||
</Playground> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.alert { | ||
padding: 15px 20px; | ||
background: white; | ||
border-radius: 3px; | ||
color: white; | ||
} | ||
|
||
.info { | ||
background: #5352ED; | ||
} | ||
|
||
.positive { | ||
background: #2ED573; | ||
} | ||
|
||
.negative { | ||
background: #FF4757; | ||
} | ||
|
||
.warning { | ||
background: #FFA502; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
background: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { css } from 'docz-plugin-css' | ||
|
||
export default { | ||
plugins: [ | ||
css({ | ||
preprocessor: 'sass', | ||
cssmodules: true, | ||
}), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "docz-example-css-sass", | ||
"version": "0.2.9", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "docz dev", | ||
"build": "docz build" | ||
}, | ||
"dependencies": { | ||
"classnames": "^2.2.6", | ||
"docz": "^0.2.9", | ||
"docz-core": "^0.2.9", | ||
"prop-types": "^15.6.2", | ||
"react": "^16.4.1", | ||
"react-dom": "^16.4.1" | ||
}, | ||
"devDependencies": { | ||
"docz-plugin-css": "^0.2.9" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { Fragment } from 'react' | ||
import cx from 'classnames' | ||
import t from 'prop-types' | ||
|
||
import styles from './Alert.module.scss' | ||
|
||
export const Alert = ({ children, kind }) => ( | ||
<div | ||
className={cx(styles.alert, { | ||
[styles[kind]]: true, | ||
})} | ||
> | ||
{children} | ||
</div> | ||
) | ||
|
||
Alert.propTypes = { | ||
kind: t.oneOf(['info', 'positive', 'negative', 'warning']), | ||
} | ||
|
||
Alert.defaultProps = { | ||
kind: 'info', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
name: Alert | ||
menu: Components | ||
--- | ||
|
||
import './index.scss' | ||
import { Playground, PropsTable } from 'docz' | ||
import { Alert } from './Alert' | ||
|
||
# Alert | ||
|
||
## Properties | ||
|
||
<PropsTable of={Alert} /> | ||
|
||
## Basic usage | ||
|
||
<Playground> | ||
<Alert>Some message</Alert> | ||
</Playground> | ||
|
||
## Using different kinds | ||
|
||
<Playground> | ||
<Alert kind="info">Some message</Alert> | ||
<Alert kind="positive">Some message</Alert> | ||
<Alert kind="negative">Some message</Alert> | ||
<Alert kind="warning">Some message</Alert> | ||
</Playground> | ||
|
||
## Use with children as a function | ||
|
||
<Playground> | ||
{() => { | ||
const message = 'Hello world' | ||
|
||
return ( | ||
<Alert>{message}</Alert> | ||
) | ||
}} | ||
</Playground> |
Oops, something went wrong.