import React from 'react' import Modal from './Modal' import Heading from '../Heading' import Button from '../Button' import Paragraph from '../Paragraph' import FileReaderInput from 'react-file-reader-input' import FileUploadIcon from 'react-icons/lib/md/file-upload' import AddIcon from 'react-icons/lib/md/add-circle-outline' import colors from '../../config/colors' import { margins, fontSizes } from '../../config/scales' import publicStyles from '../../config/styles.json' class PublicStyle extends React.Component { static propTypes = { url: React.PropTypes.string.isRequired, thumbnailUrl: React.PropTypes.string.isRequired, title: React.PropTypes.string.isRequired, onSelect: React.PropTypes.func.isRequired, } render() { return
} } class OpenModal extends React.Component { static propTypes = { isOpen: React.PropTypes.bool.isRequired, toggle: React.PropTypes.func.isRequired, onStyleOpen: React.PropTypes.func.isRequired, } onUpload(_, files) { const [e, file] = files[0]; const reader = new FileReader(); reader.readAsText(file, "UTF-8"); reader.onload = e => { let mapStyle = JSON.parse(e.target.result) mapStyle = style.ensureMetadataExists(mapStyle) this.props.onStyleOpen(mapStyle); } reader.onerror = e => console.log(e.target); } render() { const styleOptions = publicStyles.map(style => { return }) return Upload Style Upload a JSON style from your computer. Gallery Styles Open one of the publicly available styles to start from. {styleOptions} } } export default OpenModal