25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

37 lines
1.3 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;
  9. const artworkWrapper = createElement('div', ['artwork-wrapper'], null);
  10. artworkWrapper.dataset.type = type;
  11. createElement('div', ['artwork'], '<span class="background"></span><span class="foreground"></span>', artworkWrapper);
  12. if (image === 'Hamburg') {
  13. imageId = 'qpemSW6_1Z0';
  14. } else if (image === 'Berlin') {
  15. imageId = 'uFGi0_YciE0';
  16. } else if (image === 'Team') {
  17. imageId = '-VHQ0cw2euA';
  18. }
  19. if (type === 'artwork-image') {
  20. imageWidth = 800;
  21. imageHeight = 800;
  22. } else {
  23. imageWidth = 1920;
  24. imageHeight = 1080;
  25. }
  26. if (type === 'artwork-image' || type === 'background-image' || type === 'artwork-background-image') {
  27. const imageBox = createElement('div', ['image-box'], null, artworkWrapper);
  28. const picture = createElement('picture', [], null, imageBox);
  29. createImage('https://source.unsplash.com/' + imageId + '/' + imageWidth + 'x' + imageHeight, imageWidth, imageHeight, 'Artwork Image', [], picture);
  30. }
  31. return artworkWrapper;
  32. }