product_fullscreen.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { fullscreen } from "./fullscreen.js";
  2. import { product } from "./product.js";
  3. export class product_fullscreen extends fullscreen {
  4. #target;
  5. constructor(target) {
  6. super();
  7. this.#target = target;
  8. }
  9. get target() {
  10. return this.#target;
  11. }
  12. _build_node() {
  13. const container = document.createElement("div");
  14. container.classList.add("product-fullscreen-viewer");
  15. const image = document.createElement("div");
  16. image.style.backgroundImage = "url(\"" + this.target.image + "\")";
  17. image.classList.add("image");
  18. container.appendChild(image);
  19. const title = document.createElement("div");
  20. title.classList.add("title");
  21. container.appendChild(title);
  22. const title_content = document.createElement("h1");
  23. title_content.innerText = this.target.name;
  24. title.appendChild(title_content);
  25. const bottom = document.createElement("div");
  26. bottom.classList.add("bottom-side");
  27. container.appendChild(bottom);
  28. const bottom_header = document.createElement("div");
  29. bottom_header.classList.add("bottom-header");
  30. bottom.appendChild(bottom_header);
  31. const barcode_icon = document.createElement("span");
  32. barcode_icon.classList.add("material-icons");
  33. barcode_icon.innerText = "qr_code_scanner";
  34. const barcode_content = document.createElement("span");
  35. barcode_content.innerText = this.target.barcode;
  36. barcode_content.classList.add("numbers");
  37. const barcode = document.createElement("p");
  38. barcode.appendChild(barcode_icon);
  39. barcode.appendChild(barcode_content);
  40. bottom_header.appendChild(barcode);
  41. const author_icon = document.createElement("span");
  42. author_icon.classList.add("material-icons");
  43. author_icon.innerText = "attribution";
  44. const author_content = document.createElement("span");
  45. author_content.innerText = this.target.author;
  46. const author = document.createElement("p");
  47. author.appendChild(author_icon);
  48. author.appendChild(author_content);
  49. bottom_header.appendChild(author);
  50. const description = document.createElement("div");
  51. description.classList.add("description");
  52. bottom.appendChild(description);
  53. const description_content = document.createElement("p");
  54. description_content.innerText = this.target.description;
  55. description.appendChild(description_content);
  56. const close_button = document.createElement("button");
  57. close_button.classList.add("material-icons");
  58. close_button.classList.add("close");
  59. close_button.innerText = "close";
  60. container.appendChild(close_button);
  61. close_button.addEventListener("click", () => {
  62. this.hide();
  63. });
  64. return container;
  65. }
  66. }