-
Notifications
You must be signed in to change notification settings - Fork 63
Adding A Parameter
Letting the User have Input
General notes on updating/adding new input from the UI to the existing code flow
You can define its form/format in src/models/configuration.js
.
export const schema = z.object({
...
});
export const defaultConfig = schema.parse({});
Creating a Config from form data is in src/utils/formUtils.js
. Big ol'
const fromFormToConfiguration = (form) =>
schema.parse({
blah: from.has('blah'),
Remember to use form.has
for booleans and form.get
for everything else
At the top of book.js
there's update(configuration)
where you set all the this.blah = configuration.blah
s
src/main.js
has the window.addEventListener('DOMContentLoaded'
, which is where we find the DOM elements and tack on their listeners. Likely import your listener logic from 'src/utils/clickHandlers.js'. Those functions need to be
export`ed, remember.
renderFormFromSettings(configuration)
is in src/utils/renderUtils.js
document.querySelector('select[name="blah"]').value = configuration.blah;
Add your new parameter to the defaultBook
in src/book.test.js