import React from 'react'; import PropTypes from 'prop-types'; import {FormattedMessage} from 'react-intl'; import bindAll from 'lodash.bindall'; import FontName from './font-name.jsx'; import FontPlayground from './font-playground.jsx'; import FontFallback from './font-fallback.jsx'; import AddButton from './add-button.jsx'; class AddSystemFont extends React.Component { constructor (props) { super(props); bindAll(this, [ 'handleChangeName', 'handleChangeFallback', 'handleFinish' ]); this.state = { name: '', fallback: FontFallback.DEFAULT }; } handleChangeName (name) { this.setState({ name }); } handleChangeFallback (fallback) { this.setState({ fallback }); } handleFinish () { this.props.fontManager.addSystemFont(this.state.name, this.state.fallback); this.props.onClose(); } render () { return (

{this.state.name && ( )}
); } } AddSystemFont.propTypes = { fontManager: PropTypes.shape({ addSystemFont: PropTypes.func.isRequired, hasFont: PropTypes.func.isRequired }).isRequired, onClose: PropTypes.func.isRequired }; export default AddSystemFont;