all repos — h3 @ 68daa6a4f7e8660bb651e52e6d2a171984f568ad

A tiny, extremely minimalist JavaScript microframework.

docs/example/assets/js/components/NavigationBar.js

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
import { h3, h } from "../h3.js";
import Paginator from "./Paginator.js";

export default function NavigationBar() {
    // Set the todo filter.
    const setFilter = (e) => {
        h3.dispatch("todos/filter", e.target.value);
        h3.redraw();
    };
    // Filtering function for todo items
    return h("div.navigation-bar", [
        h(
            "a.nav-link",
            {
                title: "Settings",
                onclick: () => h3.navigateTo("/settings"),
            },
            "⚙"
        ),
        h("input", {
            id: "filter-text",
            placeholder: "Type to filter todo items...",
            oninput: setFilter,
        }),
        Paginator,
    ]);
}