I had to add a couple of features to the UI on the MIR infrastructure router. Not really being a UI person I could either look them up, or I could ask ChatGPT. In the end I did both, how did it pan out?
Colour Picker
The first thing I wanted to add was a colour picker. MIR now has a lot of data layers for the UK and it is helpful to be able set the colours for these, the plan was to trigger a colour picker by clicking on a randomly coloured block that the layer has as a default.
I had a few goes at this but didn't get anything satisfactory here's an example below:
system_message = "You are an expert HTML, Javascipt and CSS coder." user_message = """ Create a colour picker to change the colour of an element in a web page. """
This still wasn't ideal, so I tried a Google search for a JavaScript colour picker which led me to a site with a
collection of these and out of those I chose one called Swatchy. This is where search truly wins over chat,
because you can actually see the colour pickers in action and choose one with functionality that you like.
Modal
system_message = "You are an expert HTML, Bootstrap 5,Javascript and CSS coder."user_message = """Create a box to display some help text. It should open when a button with a help icon is clicked and close when a close button is clicked."""
Altering the text to ‘create a modal’ did better, in that it just produced HTML and CSS to hide and show the box. It did also make use of the ‘data-bs-dismiss’ Bootstrap attribute to dismiss the modal, however the CSS was unnecessary as this is already included in Bootstrap.
A quick search for ‘bootstrap 5 modal’ took me to the Bootstrap documentation and gave me a small amount of code that I could cut and paste into my site. 2-0 to search.
No comments:
Post a Comment