Skip to content

Commit

Permalink
docs(Readme): Proof read
Browse files Browse the repository at this point in the history
Proof read docs
  • Loading branch information
Raathigesh committed Apr 24, 2016
1 parent 3a4b88d commit 765e74f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ $ npm install react-dazzle --save
```

## Dazzle me
[Here is a demo.](raathigesh.com/dazzle) Widgets shows fake data though but they look so damn cool (At least for me).
[Here is a demo.](http://raathigesh.com/dazzle) Widgets shows fake data though but they look so damn cool (At least for me).

###### [Sample is available here.]()
###### [Repository of the demo is available here.](https://github.com/Raathigesh/Dazzle-Starter-Kit)

## Usage
```javascript
Expand Down Expand Up @@ -86,18 +86,18 @@ class App extends Component {
| layout | Object | Layout of the dashboard. | Yes |
| widgets | Object| Widgets that could be added to the dashboard. | Yes |
| editable | Boolean |Indicates weather the dashboard is in editable mode. | No |
| rowClass | String |CSS class name(s) that should be given to the row. Default is `row` div element. | No |
| rowClass | String |CSS class name(s) that should be given to the row div element. Default is `row`. | No |
| editableColumnClass | String |CSS class name(s) that should be used when a column is in editable mode. | No |
| droppableColumnClass | String |CSS class name(s) that should be used when a widget is about to be dropped in a column. | No |
| frameComponent | Component | Customized frame component which should be used instead of the default frame. | No |
| addWidgetComponent | Component | Customized add widget component which should be used instead of the default `AddWidgetComponent`. | No |
| addWidgetComponentText | String | Text that should be displayed in the Add Widget component. | No |
| onAdd(layout, rowIndex, columnIndex) | Function |Will be called when a widget is added.| No |
| frameComponent | Component | Customized frame component which should be used instead of the default frame. [More on custom frame components.](https://github.com/Raathigesh/Dazzle/blob/master/docs/ImplementingACustomFrame.md) | No |
| addWidgetComponent | Component | Customized add widget component which should be used instead of the default `AddWidgetComponent`. [More on custom add widget component.](https://github.com/Raathigesh/Dazzle/blob/master/docs/ImplementingCustomAddWidgetButton.md) | No |
| addWidgetComponentText | String | Text that should be displayed in the Add Widget component. Default is `Add Widget`. | No |
| onAdd(layout, rowIndex, columnIndex) | function |Will be called when user clicks the `AddWidget` component.| No |
| onRemove(layout) | function |Will be called when a widget is removed.| No |
| onMove(layout) | function | Will be called when a widget is moved.| No |

#### Providing `widgets`
`widgets` prop of the Dashboard component takes an object. A sample widgets object would look like below. This object holds all the widgets that could be used in the dashboard.
`widgets` prop of the dashboard component takes an object. A sample `widgets` object would look like below. This object holds all the widgets that could be used in the dashboard.

```javascript
{
Expand Down Expand Up @@ -132,7 +132,7 @@ The `layout` prop takes the current layout of the dashboard. Layout could have m
}
```
- `className` property - CSS class(es) that should be given to the column in the grid layout. Above sample layout uses the classes from bootstrap library. You could use the classes of your CSS library.
- `widgets` property - An array of widgets that should be rendered in the dashboard. `key` property of the widgets array should be a key from the `layout` object.
- `widgets` property - An array of widgets that should be rendered in that particular column. `key` property of the widgets array should be a key from the `widgets` object.

#### Edit mode
Setting `editable` prop to `true` will make the dashboard editable.
Expand All @@ -141,7 +141,7 @@ Setting `editable` prop to `true` will make the dashboard editable.
When user tries to add a new widget, the `onAdd` callback will be called. <a href="https://github.com/Raathigesh/Dazzle/blob/master/docs/AddWidget.md">More info here on how to handle widget addition.</a>

#### Remove a widget
When a widget is removed, `onRemove` method will be called and new layout (The layout with the widget removed) will be available as an argument of `onRemove` method. Set the provided layout again to the dashboard to complete the widget removal.
When a widget is removed, `onRemove` method will be called and new layout (The layout with the widget removed) will be available as an argument of `onRemove` method. Set the provided layout again to the dashboard to complete the widget removal. [The Sample repository has the this feature implemented](https://github.com/Raathigesh/Dazzle-Starter-Kit/blob/master/src/components/Dashboard.jsx).

## Customization

Expand Down
6 changes: 4 additions & 2 deletions docs/AddWidget.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Add New Widget To Dashboard

When add widget is clicked, `onAdd` function will be called. The `onAdd` function will be provided with the current layout, index of the row and column where the new widget should be added.
When add widget is clicked, `onAdd` function will be called. The `onAdd` function will be provided with the current `layout`, index of the `row` and `column` where the new widget should be added.

You could add a new widget to the dashboard by calling the method `addWidget` from dazzle and passing the parameters you received from the `onAdd` callback along with the key of the widget that should be added,

Below is a sample of adding a widget when `Add Widget` is clicked.

Expand Down Expand Up @@ -51,7 +53,7 @@ But in a more practical use-case, user should select the widget he wants to add

You could show a modal dialog with all the widgets that could be added and allow the user to select one widget.

When user selects a widget, call the `addWidget` method with the name of the widget along with other parameters.
When user selects a widget, call the `addWidget` method with the key of the widget along with other parameters.

[The sample project has such implementation](https://github.com/Raathigesh/Dazzle-Starter-Kit). [Refer the `Dashboard` component](https://github.com/Raathigesh/Dazzle-Starter-Kit/blob/master/src/components/Dashboard.jsx) for more details.

Expand Down
8 changes: 4 additions & 4 deletions docs/ImplementingACustomFrame.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@ const CustomFrame = ({title, editable, children, onRemove }) => {
};
```

A custom frame is just another React component. Custom frame will be provided with 4 properties you can make use of as follows.
A custom frame is just another React component. Custom frame will be provided with 4 props.

| Props | Type | Description |
| --- | --- | --- |
| title | String | Title that should be displayed in the frame. |
| editable | Boolean | Denotes weather the dashboard is in editable mode or not. You can use this |
| editable | Boolean | Denotes weather the dashboard is in editable mode or not. |
| children | React element | Children of the frame. The widget that is going to be rendered. |
| onRemove | function | The function that should be called when you want to remove the widget. |

### How to let dazzle know about this?
Well it's extremely simple.
Well, it's extremely simple.

```javascript
import Dashboard from 'react-dazzle';
import CustomFrame from './CustomFrame';

<Dashboard /* Other props goes here*/ frame={CustomFrame} />
<Dashboard /* Other props goes here*/ frameComponent={CustomFrame} />
```

Now all the widgets will use your fancy frame.
Expand Down
4 changes: 3 additions & 1 deletion docs/ImplementingCustomAddWidgetButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Add widget component is the one which appears on top of columns when dashboard i

### Show me the code

> Below example uses [React's state-less components](https://facebook.github.io/react/docs/reusable-components.html#stateless-functions).
```javascript
const CustomAddWidgetButton = ({text, onClick}) => {
return (
Expand All @@ -15,7 +17,7 @@ const CustomAddWidgetButton = ({text, onClick}) => {
};
```

A custom `Add Widget` Component is just another React component. This component will be provided with 2 props you can make use of as follows.
A custom `AddWidget` component is just another React component. This component will be provided with 2 props.

| Props | Type | Description |
| --- | --- | --- |
Expand Down

0 comments on commit 765e74f

Please sign in to comment.