import {defineMessages, FormattedMessage, intlShape, injectIntl} from 'react-intl'; import PropTypes from 'prop-types'; import React from 'react'; import classNames from 'classnames'; import Modal from '../../containers/modal.jsx'; import ManageFont from './manage-font.jsx'; import AddSystemFont from './add-system-font.jsx'; import AddCustomFont, {FONT_FORMATS} from './add-custom-font.jsx'; import styles from './fonts-modal.css'; const messages = defineMessages({ title: { defaultMessage: 'Fonts', description: 'Title of custom font management modal', id: 'tw.fonts.title' } }); const FontModal = props => (
{props.screen === '' ? (
) : props.screen === 'system' ? ( ) : props.screen === 'custom' ? ( ) : ( // Should never happen null )} {props.screen === '' && (

{props.fonts.length ? ( ) : ( )}

{props.fonts.length > 0 && (
{props.fonts.map((font, index) => ( ))}
)}
)}
); FontModal.propTypes = { intl: intlShape, onClose: PropTypes.func.isRequired, fonts: PropTypes.arrayOf(PropTypes.shape({ system: PropTypes.bool.isRequired, name: PropTypes.string.isRequired, family: PropTypes.string.isRequired, data: PropTypes.instanceOf(Uint8Array), format: PropTypes.string }).isRequired).isRequired, fontManager: PropTypes.shape({}), screen: PropTypes.oneOf([ '', 'system', 'custom' ]), onOpenSystemFonts: PropTypes.func.isRequired, // onOpenLibraryFonts: PropTypes.func.isRequired, onOpenCustomFonts: PropTypes.func.isRequired }; export default injectIntl(FontModal);