import React, { PropTypes } from 'react'; import Clipboard from 'clipboard'; class CopyableInput extends React.Component { constructor(props) { super(props); this.onMouseLeaveHandler = this.onMouseLeaveHandler.bind(this); } componentDidMount() { this.clipboard = new Clipboard(this.input, { target: () => this.input }); this.clipboard.on('success', (e) => { this.tooltip.classList.add('tooltipped'); this.tooltip.classList.add('tooltipped-n'); }); } componentWillUnmount() { this.clipboard.destroy(); } onMouseLeaveHandler() { this.tooltip.classList.remove('tooltipped'); this.tooltip.classList.remove('tooltipped-n'); } render() { const { label, value } = this.props; return (