I realize this may be subjective, but I don't see any clear-cut place for asking questions on good software design principals. I'm sure there are some software patterns and anti-patterns I should be aware of here.
I'm not asking about UI/UX or how to code anything. I am asking what would be a good design pattern to follow when creating multiple HMTL buttons that all to similar, but distinct things - In this case, loading files
I am developing a GUI, part of which has a save feature. There is a list of save file slots, and for each slot, there would be a preview of the saved content in that slot, plus a button to load/delete/save, etc. This is all done via HTML and Javascript
Which of the following would be the best way to implement the buttons? For example, with the "Load" Button, I could:
- Have a single HTML Button for "Load". The behavior of this button (What file it loads) is changed by the Javascript, based off which saved slot you selected.
- Have a "Load" button for each save slot written into the HMTL, each dedicated to loading the file from their pre-assigned slot. The buttons are shown/hidden by Javascript based off what you selected.
- Similar to the above but instead of writing each button in HMTL outright, I could dynamically insert the HTML and remove it using Javascript, based on which slot you select.
- Something else entirely?
The way I currently have the program written (with static, non-functional buttons), There is a single HMTL button located off to the side of the saved slots.
Here's a screen cap of the interface, just to provide context of how these button are used:
