import React from 'react'; import Switch from '@mui/material/Switch'; import TextField from '@mui/material/TextField'; import FormControlLabel from '@mui/material/FormControlLabel'; import type { ImageLoaded, ImageUploaded } from '@react-page/editor'; import { ImageUpload } from '@react-page/editor'; import Typography from '@mui/material/Typography'; import type { 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.data.isParallax === undefined ? false : !this.props.data.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 { data: { isParallax = true, background = '' }, } = this.props; return (
{this.props.imageUpload && ( {this.props.translations?.or} )} } label={this.props.translations?.isParallax} />
); } } export default ImageComponent;