Skip to content

Commit

Permalink
docs: ✏️ updated renderer docs
Browse files Browse the repository at this point in the history
update in renderer docs to include style and measure property
description
  • Loading branch information
diogofcunha committed Jan 19, 2019
1 parent 3d6bfa1 commit 3bdd522
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions demo/src/docs/renderers.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# Renderers

A renderer is a component you can use to build your tree stucture. The power of it is that you can either use the renderers shipped with this package or you can create your own! A few examples on how to achieve it can be found at the examples section.

## Injected props
| Name | Type | Description |
| ------------- | ------------- | ----------- |
| onChange | ({ node: Node *, type: UPDATE_TYPE *}) => void | to be invoked with the updated node and the update type |
| node | Node * | The node being rendered for that row, with some additional info|
| children | JSX | Anything your render as children of the component when using it|

* Node = {
| Name | Type | Description |
| -------- | ---------------------------------------------- | ------------------------------------------------------------------------------------- |
| onChange | ({ node: Node _, type: UPDATE_TYPE _}) => void | to be invoked with the updated node and the update type |
| node | Node \* | The node being rendered for that row, with some additional info |
| children | JSX | Anything your render as children of the component when using it |
| style | React.CSSProperties | A opt in style property that will auto align your items and apply some default styles |
| measure | () => void | A function that can be used to let the tree know about your node measurements |

- Node = {
id: number
name: string,
state: object,
deepness: number,
parents: number[]
}
* UPDATE_TYPE = {
}
- UPDATE_TYPE = {
ADD: 0,
DELETE: 1,
UPDATE: 2
}
}

0 comments on commit 3bdd522

Please sign in to comment.