From 5c1f14f239b686cedcc9ed30054b79cd529adde0 Mon Sep 17 00:00:00 2001 From: Hiroyoshi Takahashi Date: Sun, 22 Nov 2015 00:34:43 +0900 Subject: [PATCH] update README --- README.md | 43 ++++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2f1bfe3..007340e 100644 --- a/README.md +++ b/README.md @@ -28,22 +28,22 @@ npm install react-dnd-item --save ```js import React, { Component } from 'react'; -import { DragDropContext }from "react-dnd"; -import HTML5Backend from "react-dnd-html5-backend"; -import { DnDItem, DropPositions } from "react-dnd-item"; +import { DragDropContext }from 'react-dnd'; +import HTML5Backend from 'react-dnd-html5-backend'; +import { DnDItem, DropPositions } from 'react-dnd-item'; @DragDropContext(HTML5Backend) -export default class YourComponent extends Component { +export default class ExampleDnD extends Component { constructor(props) { super(props); this.state = { - somethings = [ - {id: "1", name: "somethigs1"}, - {id: "2", name: "somethigs2"}, - {id: "3", name: "somethigs3"}, - {id: "4", name: "somethigs4"}, - {id: "5", name: "somethigs5"}, - {id: "6", name: "somethigs6"} + somethings: [ + {id: '1', name: 'somethigs1'}, + {id: '2', name: 'somethigs2'}, + {id: '3', name: 'somethigs3'}, + {id: '4', name: 'somethigs4'}, + {id: '5', name: 'somethigs5'}, + {id: '6', name: 'somethigs6'} ] }; } @@ -65,24 +65,25 @@ export default class YourComponent extends Component { switch (position) { case TOP_LEFT: - // some actions + // return some action case TOP_CENTER: - // some actions + // return some action case TOP_RIGHT: - // some actions + // return some action case MIDDLE_LEFT: - // some actions + // return some action case MIDDLE_CENTER: - // some actions + // return some action case MIDDLE_RIGHT: - // some actions + // return some action case BOTTOM_LEFT: - // some actions + // return some action case BOTTOM_CENTER: - // some actions + // return some action case BOTTOM_RIGHT: - // some actions + // return some action default: + return false; } } @@ -100,7 +101,7 @@ export default class YourComponent extends Component {
{somethings.map(something => -
{item.name}
+
{something.name}
)}
diff --git a/package.json b/package.json index 8766959..6331bd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-dnd-item", - "version": "0.1.0", + "version": "0.1.1", "description": "A draggable and droppable item comopnent for React", "main": "lib/index.js", "scripts": {