import React, { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import FormField from '../inputs/FormField' import StringInput from '../inputs/StringInput' import PreviewDialog from './PreviewDialog' /** * SaveNewSceneDialog used to show dialog when to save new scene. * * @param {string} thumbnailUrl * @param {string} initialName * @param {function} onConfirm * @param {function} onCancel * @constructor */ export function SaveNewSceneDialog({ thumbnailUrl, initialName, onConfirm, onCancel }) { const [name, setName] = useState(initialName) const { t } = useTranslation() const onChangeName = useCallback( (value) => { setName(value) }, [setName] ) /** * onConfirmCallback callback function is used handle confirm dialog. * * @type {function} */ const onConfirmCallback = useCallback( (e) => { e.preventDefault() onConfirm({ name }) }, [name, onConfirm] ) /** * onCancelCallback callback function used to handle cancel of dialog. * * @type {function} */ const onCancelCallback = useCallback( (e) => { e.preventDefault() onCancel() }, [onCancel] ) //returning view for dialog view. return ( ) } export default SaveNewSceneDialog