all repos — h3 @ cf18fcdb77466464bfe4adc7622efd5ecf740a33

A tiny, extremely minimalist JavaScript microframework.

example/assets/js/components/addTodoForm.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
import h3 from "../h3.js";

export default function AddTodoForm(actions) {
  const { addTodo, addTodoOnEnter, updateError, updateMainSection } = actions;
  return h3("form.add-todo-form", [
    h3("input", {
      id: "new-todo",
      placeholder: "What do you want to do?",
      autofocus: true,
      onkeydown: (event) => addTodoOnEnter(event, updateError, updateMainSection),
    }),
    h3(
      "span.submit-todo",
      {
        onclick: () => addTodo(updateError, updateMainSection),
      },
      ["+"]
    ),
  ]);
}