You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

45 regels
1.6 KiB

  1. import './artwork.scss';
  2. import {createElement, createImage} from "../../_global/scripts/helpers";
  3. export const createArtwork =
  4. ({
  5. type = 'artwork-image',
  6. image = 'Berlin',
  7. }) => {
  8. let imageId, imageWidth, imageHeight, imageSize;
  9. const artworkWrapper = createElement('div', ['artwork-wrapper'], null);
  10. artworkWrapper.dataset.type = type;
  11. if (type === 'artwork-both-sides' ){
  12. createElement('div', ['artwork-left'], '<span class="background"></span><span class="foreground"></span>', artworkWrapper);
  13. }
  14. createElement('div', ['artwork'], '<span class="background"></span><span class="foreground"></span>', artworkWrapper);
  15. if (image === 'Hamburg') {
  16. imageId = 'qpemSW6_1Z0';
  17. } else if (image === 'Berlin') {
  18. imageId = 'uFGi0_YciE0';
  19. } else if (image === 'Team') {
  20. imageId = '-VHQ0cw2euA';
  21. }
  22. if (type === 'artwork-image') {
  23. imageWidth = 800;
  24. imageHeight = 800;
  25. imageSize = '1-1';
  26. } else {
  27. imageWidth = 1920;
  28. imageHeight = 1080;
  29. imageSize = '3-2';
  30. }
  31. if (type === 'artwork-image' || type === 'background-image' || type === 'artwork-background-image') {
  32. const imageBox = createElement('div', ['image-box'], null, artworkWrapper);
  33. const picture = createElement('picture', [], null, imageBox);
  34. //createImage('https://source.unsplash.com/' + imageId + '/' + imageWidth + 'x' + imageHeight, imageWidth, imageHeight, 'Artwork Image', [], picture);
  35. createImage('./dummy/placeholder-' + imageSize + '.svg', imageWidth, imageHeight, 'Artwork Image', [], picture);
  36. }
  37. return artworkWrapper;
  38. }