Skip to content

Commit

Permalink
Updated the README and other small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmilner committed Aug 22, 2019
1 parent 5096656 commit 5d77bc5
Show file tree
Hide file tree
Showing 4 changed files with 7,988 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ node_modules
# Other
.DS_Store
.env
package-lock.json
yarn.lock
yarn-error.log
45 changes: 20 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,43 @@ React components for displaying Gutenberg blocks from WordPress.

These components were built to be used in combination with [WPGraphQL](https://wpgraphql.com/) and [wp-graphql-gutenberg](https://github.com/pristas-peter/wp-graphql-gutenberg), but can be used in any React project.

Currently available components:
Currently supported blocks:

* CoreCodeBlock
* CoreHeadingBlock
* CoreParagraphBlock
* Code
* Heading
* Image
* List
* Paragraph

## Installation and usage
First, install __wp-block-components__ from npm.
```
yarn add wp-block-components
```
Next, import the components into your app.
Next, import the component into your app.
```js
import {
CoreCodeBlock,
CoreHeadingBlock,
CoreParagraphBlock
} from 'wp-block-components';
import { CoreBlock } from 'wp-block-components';
```

## Props
Each components has only one prop.
The component has only one prop.

* `attributes` - An object of block attributes returned from WordPress.
* `block` - A block object returned from WPGraphQL.

### Attribute prop example
### Block prop example
```js
{
align: null,
backgroundColor: null,
className: null,
content: '',
customBackgroundColor: null,
customFontSize: null,
customTextColor: null,
direction: null,
dropCap: null,
fontSize: null,
textColor: null,
__typename: 'WordPress_CoreHeadingBlock',
attributes: {
align: null,
anchor: null,
className: null,
content: 'This is a heading',
level: 2,
}
}
```

## Styles

These components uses [Gutenberg Theme Support](https://developer.wordpress.org/block-editor/developers/themes/theme-support/) classes so that you can style everything exactly how you want.
These components use the [Gutenberg Theme Support](https://developer.wordpress.org/block-editor/developers/themes/theme-support/) classes, just like WordPress. Each block also has its own class in order to easily target your styles. For example, the `CoreHeadingBlock` component has a class of `core-block-heading`.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-block-components",
"version": "0.1.1",
"version": "0.2.0",
"description": "Gutenberg block components for React",
"main": "lib/index.js",
"scripts": {
Expand All @@ -18,7 +18,7 @@
"type": "git",
"url": "git+https://github.com/danielmilner/wp-block-components.git"
},
"author": "Daniel Milner <[email protected]>",
"author": "Daniel Milner <[email protected]>",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/danielmilner/wp-block-components/issues"
Expand Down
Loading

0 comments on commit 5d77bc5

Please sign in to comment.