Last active
January 15, 2021 20:14
-
-
Save eggei/49fe7ef470fd4855a022543b782d9d54 to your computer and use it in GitHub Desktop.
Abstraction or no abstraction?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* MUI interface for modals */ | |
<Dialog | |
open={openSaveDialog} | |
onClose={toggle} | |
aria-labelledby="form-dialog-title" | |
maxWidth="sm" | |
fullWidth | |
> | |
<DialogTitle>{title}</DialogTitle> | |
<DialogContent>{content}</DialogContent> | |
<DialogActions> | |
<Button onClick={toggle}>Cancel</Button> | |
<Button type="submit">Save</Button> | |
</DialogActions> | |
</Dialog> | |
/* This is how we could abstract it and wrap it with some default configs */ | |
<Modal | |
id="id" | |
fullWidth | |
open={openSaveDialog} | |
onClose={toggle} | |
modalTitle={title} | |
modalContent={content} | |
actionButtons={[ | |
{ | |
label: 'Cancel', | |
onClick: toggle, | |
}, | |
{ label: 'Save', type: 'submit' }, | |
]} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can anyone see any advantage in having MUI Dialog interface wrapped as shown in the latter abstraction?