File size: 545 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { PureComponent } from 'react';
import ClipboardButton from '../';

export default class extends PureComponent {
	static displayName = 'ClipboardButtons';

	state = {
		isCopied: false,
	};

	onCopy = () => {
		this.setState( {
			isCopied: true,
		} );
	};

	render() {
		return (
			<div>
				<ClipboardButton
					onCopy={ this.onCopy }
					text="This text was copied via ClipboardButton"
					style={ { float: 'none' } }
				>
					{ this.state.isCopied ? 'Copied!' : 'Copy to clipboard' }
				</ClipboardButton>
			</div>
		);
	}
}