Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples and README #59

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ then include as
```js
import React from 'react';
import ReactDOM from 'react-dom';
import createReactClass from 'create-react-class';
import CopyToClipboard from 'react-copy-to-clipboard';

const App = React.createClass({
const App = createReactClass({
getInitialState() {
return {value: '', copied: false};
},
Expand Down Expand Up @@ -108,12 +109,12 @@ ReactDOM.render(<App />, appRoot);
## Options


#### `text`: React.PropTypes.string.isRequired
#### `text`: PropTypes.string.isRequired

Text to be copied to clipboard


#### `onCopy`: React.PropTypes.func
#### `onCopy`: PropTypes.func

Optional callback, will be called when text is copied

Expand All @@ -123,13 +124,13 @@ onCopy(text, result)
`result (bool)`: Returns `true` if copied successfully, else `false`.


#### `options`: React.PropTypes.shape({debug: bool, message: string})
#### `options`: PropTypes.shape({debug: bool, message: string})

Optional [copy-to-clipboard](https://npm.im/copy-to-clipboard) options.

See [API docs](https://npm.im/copy-to-clipboard#api) for details

#### `children`: React.PropTypes.node.isRequired
#### `children`: PropTypes.node.isRequired

CopyToClipboard is a simple wrapping component, it does not render any tags, so it requires the only child element to be present, which will be used to capture clicks.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
},
"devDependencies": {
"copy-to-clipboard": "3.0.5",
"react-component-template": "0.1.5"
"react-component-template": "0.1.9"
}
}
3 changes: 2 additions & 1 deletion src/example/App/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import createReactClass from 'create-react-class';
import CopyToClipboard from '../..';
import {name} from '../../../package.json';
import css from './App.css';


const App = React.createClass({
const App = createReactClass({
getInitialState() {
return {value: '', copied: false};
},
Expand Down