@hello-pangea/color-picker
Version:
React color pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
18 lines (15 loc) • 494 B
JavaScript
/* eslint-disable no-invalid-this */
import React from "react";
export const handleFocus = (Component, Span = "span") =>
class Focus extends React.Component {
state = { focus: false };
handleFocus = () => this.setState({ focus: true });
handleBlur = () => this.setState({ focus: false });
render() {
return (
<Span onFocus={this.handleFocus} onBlur={this.handleBlur}>
<Component {...this.props} {...this.state} />
</Span>
);
}
};