UNPKG

@cc98/react-ubb-editor

Version:
35 lines (34 loc) 1.12 kB
import { __extends } from "tslib"; import { faEyeDropper } from '@fortawesome/free-solid-svg-icons'; import React from 'react'; import { GithubPicker } from 'react-color'; import createAction from '../../createAction'; import { ConfigType } from '../../types'; var ColorPicker = /** @class */ (function (_super) { __extends(ColorPicker, _super); function ColorPicker() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.handleOk = function (result) { var dispatch = _this.props.dispatch; dispatch(createAction(config, { mainValue: result.hex, }, { shouldSelect: true, })); }; return _this; } ColorPicker.prototype.render = function () { return React.createElement(GithubPicker, { onChangeComplete: this.handleOk }); }; return ColorPicker; }(React.PureComponent)); var config = { type: ConfigType.Custom, tagName: 'color', icon: faEyeDropper, index: 100, Component: ColorPicker, title: '颜色', }; export default config;