Advertisement
Guest User

Untitled

a guest
May 27th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       function setContainerAlignment(alignment) {
  2.         let x = setHorizontalContainerAlignment(alignment)
  3.         let y = setVerticalContainerAlignment(alignment)
  4.         return {'justify-content': x, 'align-items': y}
  5.       }
  6.  
  7.       function setVerticalContainerAlignment(alignment) {
  8.         if (alignment.includes('top')) {
  9.           return 'flex-start';
  10.         }
  11.  
  12.         if (alignment.includes('bottom')) {
  13.           return 'flex-end';
  14.         }
  15.  
  16.         return 'center';
  17.       }
  18.  
  19.       function setHorizontalContainerAlignment(alignment) {
  20.         if (alignment.includes('left')) {
  21.           return 'flex-start';
  22.         }
  23.  
  24.         if (alignment.includes('right')) {
  25.           return 'flex-end';
  26.         }
  27.  
  28.         return 'center';
  29.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement