@thi.ng/rdom-components
Version:
Collection of unstyled, customizable components for @thi.ng/rdom
21 lines (20 loc) • 530 B
JavaScript
import { anchor } from "@thi.ng/hiccup-html/inline";
import { table, tbody, td, tr } from "@thi.ng/hiccup-html/table";
import { map } from "@thi.ng/transducers/map";
import { normRange } from "@thi.ng/transducers/norm-range";
const verticalRuler = (attribs = {}, numSteps = 4) => table(
attribs,
tbody(
{},
...map(
(x) => {
const id = `${x * 100 | 0}%`;
return tr({}, td({ id }, anchor({ href: `#${id}` }, id)));
},
normRange(numSteps, false)
)
)
);
export {
verticalRuler
};