selector.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { view } from "./view.js";
  2. import { cx_ui } from "./cx-ui.js";
  3. import { dictionary } from "./dictionary.js";
  4. import { shelf } from "./shelf.js";
  5. import { space } from "./space.js";
  6. export class selector extends view {
  7. #shelf() {
  8. this.manager.view = shelf;
  9. }
  10. #space() {
  11. this.manager.view = space;
  12. }
  13. show() {
  14. const lang = new dictionary();
  15. const container = cx_ui.div("selector");
  16. const shelf = cx_ui.div("shelf");
  17. const space = cx_ui.div("space");
  18. const shelf_icon = cx_ui.image(
  19. "shelf-image",
  20. "./static/icons/shelf.svg",
  21. () => { this.#shelf(); }
  22. );
  23. const space_icon = cx_ui.image(
  24. "space-icon",
  25. "./static/icons/space.svg",
  26. () => { this.#space(); }
  27. );
  28. const shelf_title = cx_ui.p("shelf-title", lang.get("selector.shelf"));
  29. const space_title = cx_ui.p("space-title", lang.get("selector.space"));
  30. shelf.appendChild(shelf_icon);
  31. shelf.appendChild(shelf_title);
  32. space.appendChild(space_icon);
  33. space.appendChild(space_title);
  34. container.appendChild(shelf);
  35. container.appendChild(space);
  36. return container;
  37. }
  38. }