import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { TextField, Grid } from '@material-ui/core'; import { useCommonStyles } from '../../common.styles'; import icons from './icon-names'; import MySelect from '../common/select'; function ApplicationUpdate({ application, storeApplicationMetaData }) { const { appName, icon, url, description } = application; const [localUrl, setLocalUrl] = useState(url); const [localDescription, setLocalDescription] = useState(description); const commonStyles = useCommonStyles(); return ( ({ key: v, label: v }))} value={icon || 'apps'} onChange={e => storeApplicationMetaData(appName, 'icon', e.target.value)} /> setLocalUrl(e.target.value)} label="Application URL" placeholder="https://example.com" type="url" variant="outlined" size="small" onBlur={() => storeApplicationMetaData(appName, 'url', localUrl)} /> setLocalDescription(e.target.value)} onBlur={() => storeApplicationMetaData(appName, 'description', localDescription)} /> ); } ApplicationUpdate.propTypes = { application: PropTypes.object.isRequired, storeApplicationMetaData: PropTypes.func.isRequired, }; export default ApplicationUpdate;