feat: add cancel button
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| import React, { useState, useEffect } from 'react'; | ||||
| import { Box, Button, TextField, Grid } from '@mui/material'; | ||||
|  | ||||
| export default function AddOrEditProductForm({ onAdd, initialData }) { | ||||
| export default function AddOrEditProductForm({ onAdd, initialData, onCancel }) { | ||||
|   const [product, setProduct] = useState({ | ||||
|     name: '', | ||||
|     price: '', | ||||
| @@ -88,11 +88,13 @@ export default function AddOrEditProductForm({ onAdd, initialData }) { | ||||
|         onChange={handleChange} | ||||
|         margin="normal" | ||||
|       /> | ||||
|       <Box display="flex" justifyContent="flex-end" mt={2}> | ||||
|         <Button variant="contained" onClick={handleSubmit}> | ||||
|           Save | ||||
|         </Button> | ||||
|      <Box mt={2}> | ||||
|       {/* Fields... */} | ||||
|       <Box display="flex" justifyContent="flex-end" gap={1} mt={2}> | ||||
|         <Button onClick={onCancel}>Cancel</Button> | ||||
|         <Button variant="contained" onClick={handleSubmit}>Save</Button> | ||||
|       </Box> | ||||
|     </Box> | ||||
|     </Box> | ||||
|   ); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Rodolfo Ruiz
					Rodolfo Ruiz