We all know the good ol alert()
method
Yet could use some improvements so devs don’t have to create their own, dialog to show a simple alert message or import a library just to have different styling.
Proposal
There’s only so much alert()
could do, so not much to style
Have alert()
take a second argument:
alert('This is the message', {
// Title
title: {
// All styling
color: 'black'
},
// The box where the message displays
messageBox: {
// All Styling
color: 'white',
background: 'lightblue'
fontSize: '15px'
},
// There could be added buttons, which ONLY have a title and onclick handler and styles
buttons: [
{
title: 'Yes',
onclick: function() {...},
style: {
color: 'White',
background: 'lightblue'
}
},
{
title: 'No',
onclick: function() {...},
style: {
color: 'White',
background: 'lightblue'
}
}
]
});