Refactor EditThingStateModal to use ResponsiveModal for improved consistency
This commit is contained in:
@@ -7,9 +7,11 @@ import {
|
|||||||
Typography,
|
Typography,
|
||||||
} from '@mui/joy'
|
} from '@mui/joy'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import FadeModal from '../../../components/common/FadeModal'
|
import { useResponsiveModal } from '../../../hooks/useResponsiveModal'
|
||||||
|
|
||||||
function EditThingStateModal({ isOpen, onClose, onSave, currentThing }) {
|
function EditThingStateModal({ isOpen, onClose, onSave, currentThing }) {
|
||||||
|
const { ResponsiveModal } = useResponsiveModal()
|
||||||
|
|
||||||
const [state, setState] = useState(currentThing?.state || '')
|
const [state, setState] = useState(currentThing?.state || '')
|
||||||
const [errors, setErrors] = useState({})
|
const [errors, setErrors] = useState({})
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@ function EditThingStateModal({ isOpen, onClose, onSave, currentThing }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FadeModal open={isOpen} onClose={onClose}>
|
<ResponsiveModal open={isOpen} onClose={onClose}>
|
||||||
<Typography level='h4'>Update state</Typography>
|
<Typography level='h4'>Update state</Typography>
|
||||||
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@@ -60,7 +62,7 @@ function EditThingStateModal({ isOpen, onClose, onSave, currentThing }) {
|
|||||||
{currentThing?.id ? 'Cancel' : 'Close'}
|
{currentThing?.id ? 'Cancel' : 'Close'}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</FadeModal>
|
</ResponsiveModal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export default EditThingStateModal
|
export default EditThingStateModal
|
||||||
|
|||||||
Reference in New Issue
Block a user