import * as React from 'react'; import Switch from '@material-ui/core/Switch'; import TextField from '@material-ui/core/TextField'; import FormControlLabel from '@material-ui/core/FormControlLabel'; import { ImageUpload } from 'ory-editor-ui'; import Typography from '@material-ui/core/Typography'; import { ImageLoaded, ImageUploaded } from 'ory-editor-ui/lib/ImageUpload'; import { BackgroundProps } from '../../types/component'; export interface ImageComponentProps { ensureModeOn: () => void; onImageLoaded: (image: ImageLoaded) => void; onImageUploaded: () => void; } class ImageComponent extends React.Component< BackgroundProps & ImageComponentProps > { handleChangeBackground = (e: React.ChangeEvent) => { this.props.ensureModeOn(); this.props.onChange({ background: e.target.value }); } handleChangeIsParallax = (e: React.ChangeEvent) => { this.props.ensureModeOn(); this.props.onChange({ isParallax: this.props.state.isParallax === undefined ? false : !this.props.state.isParallax, }); } handleImageLoaded = (image: ImageLoaded) => { this.props.ensureModeOn(); this.props.onImageLoaded(image); } handleImageUploaded = (resp: ImageUploaded) => { this.props.onImageUploaded(); this.props.onChange({ background: resp.url }); } render() { const { state: { isParallax = true, background = '' }, } = this.props; return (
{this.props.imageUpload && ( OR )}

} label="Is parallax" />
); } } export default ImageComponent;