wix-style-react
Version:
41 lines (37 loc) • 1.11 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { DataHooks } from './constants';
import { classes } from './ColorPickerHistory.st.css';
var ColorPickerHistory = function ColorPickerHistory(_ref) {
var show = _ref.show,
current = _ref.current,
previous = _ref.previous,
_onClick = _ref.onClick;
if (show) {
return /*#__PURE__*/React.createElement("div", {
className: classes.root,
"data-hook": DataHooks.history
}, /*#__PURE__*/React.createElement("div", {
"data-hook": DataHooks.historyPrevious,
style: {
background: previous.hex()
},
onClick: function onClick() {
return _onClick(previous);
}
}), /*#__PURE__*/React.createElement("div", {
"data-hook": DataHooks.historyCurrent,
style: {
background: current.hex()
}
}));
}
return null;
};
ColorPickerHistory.propTypes = {
show: PropTypes.bool.isRequired,
previous: PropTypes.object.isRequired,
current: PropTypes.object.isRequired,
onClick: PropTypes.func.isRequired
};
export default ColorPickerHistory;