Advertisement
lukibeni

book css

Nov 15th, 2020
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 6.30 KB | None | 0 0
  1. @import "../../../scss/abstracts/variables";
  2.  
  3. /*
  4.  
  5. 1 cm és 0.5 cm-es padding-ek %-ban
  6.  
  7. Portrait  21.0 x 29.7
  8. Square    21.0 x 21.0
  9. Landscape 29.7 x 21.0
  10.  
  11. 14.8 -> image-padding: 3,3783784%
  12. 21.0 -> image-padding: 2,3809524%
  13. 29.4 -> image-padding: 1,7006803%
  14. 29.7 -> image-padding: 1,6835017%
  15.  
  16. */
  17.  
  18. .book {
  19.   display: flex;
  20.   align-items: center;
  21.   flex-direction: column;
  22.  
  23.   .pages {
  24.     display: flex;
  25.     justify-content: center;
  26.     flex-wrap: wrap;
  27.     position: relative;
  28.     width: calc(2 * 166px);
  29.  
  30.     .page {
  31.       text-align: center;
  32.       font-size: 0.875rem;
  33.       margin-bottom: 1rem;
  34.  
  35.       .custom-placeholder {
  36.         background: #ccc;
  37.         border: dotted 3px #999;
  38.         min-height: 60px;
  39.         transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
  40.       }
  41.  
  42.       .layout-holder {
  43.         width: 100%;
  44.         height: 100%;
  45.  
  46.         .preview {
  47.           position: relative;
  48.           width: 166px;
  49.           height: 166px;
  50.           margin-bottom: 5px;
  51.           border-width: 2px;
  52.           border-color: rgb(183, 183, 183);
  53.           border-style: solid;
  54.           border-radius: 3px;
  55.           background-origin: content-box;
  56.           background-repeat: no-repeat;
  57.           background-size: cover;
  58.           display: flex;
  59.           flex-wrap: wrap;
  60.  
  61.           .layout-element {
  62.             width: 100%;
  63.             height: 100%;
  64.             background-repeat: no-repeat;
  65.             overflow: hidden;
  66.             position: relative;
  67.  
  68.             span.text {
  69.               position: absolute;
  70.               left: 0;
  71.               top: 0;
  72.               border-radius: 8px;
  73.               user-select: none;
  74.               white-space: pre;
  75.             }
  76.           }
  77.  
  78.           .controls {
  79.             top: 50%;
  80.             bottom: inherit;
  81.             left: 50%;
  82.             transform: translate(-50%, -50%);
  83.             width: 100%;
  84.             position: absolute;
  85.  
  86.             a {
  87.               color: #ffffff;
  88.               border: 1px solid #ffffff;
  89.               background-color: rgba(0, 0, 0, 0.5);
  90.               border-radius: 1px;
  91.             }
  92.           }
  93.         }
  94.       }
  95.  
  96.       &:not(.cover) {
  97.         &:nth-child(1) {
  98.           .preview {
  99.             border-width: 2px 1px 2px 2px;
  100.             border-radius: 3px 0 0 3px;
  101.           }
  102.         }
  103.  
  104.         &:nth-child(2) {
  105.           .preview {
  106.             border-width: 2px 2px 2px 1px;
  107.             border-radius: 0 3px 3px 0;
  108.           }
  109.         }
  110.       }
  111.     }
  112.  
  113.     .page-controls {
  114.       position: absolute;
  115.       z-index: 2;
  116.  
  117.       a {
  118.         padding: 0.5rem;
  119.         margin: 2px;
  120.         line-height: 0;
  121.         font-weight: normal;
  122.         background: #ffffff;
  123.         color: $light-grey;
  124.         border: 1px solid $light-grey;
  125.       }
  126.     }
  127.   }
  128.  
  129.   .controls {
  130.     position: absolute;
  131.     display: none;
  132.     bottom: 0.5rem;
  133.  
  134.     a {
  135.       padding: 0.5rem;
  136.       margin: 2px;
  137.       line-height: 0;
  138.       font-weight: normal;
  139.       background: #ffffff;
  140.       color: $light-grey;
  141.       border: 1px solid $light-grey;
  142.     }
  143.   }
  144.  
  145.   &.editing {
  146.     .controls {
  147.       display: flex;
  148.       justify-content: center;
  149.       align-items: center;
  150.     }
  151.  
  152.     .pages {
  153.       .page-controls {
  154.         display: flex;
  155.       }
  156.     }
  157.  
  158.     &.page-view {
  159.       .controls {
  160.         position: relative;
  161.       }
  162.     }
  163.   }
  164.  
  165.   &.square {
  166.     .pages {
  167.       width: calc(2 * 166px);
  168.  
  169.       .page {
  170.         .layout-holder {
  171.           .preview {
  172.             width: 166px;
  173.             height: 166px;
  174.             padding: calc(2.3809524% / 2);
  175.  
  176.             .layout-item {
  177.               padding: calc(2.3809524% / 2);
  178.             }
  179.           }
  180.         }
  181.       }
  182.  
  183.       .page-controls {
  184.         transform: translate(calc(166.5px - 50%), 150px);
  185.       }
  186.     }
  187.  
  188.     &.page-view {
  189.       .pages {
  190.         width: min(100vw, 600px);
  191.         height: min(100vw, 600px);
  192.  
  193.         .page {
  194.           width: min(100vw, 600px);
  195.           height: min(100vw, 600px);
  196.  
  197.           .layout-holder {
  198.             .preview {
  199.               width: 100%;
  200.               height: 100%;
  201.               padding: calc(2.3809524% / 2);
  202.  
  203.               .layout-item {
  204.                 padding: calc(2.3809524% / 2);
  205.               }
  206.             }
  207.           }
  208.         }
  209.       }
  210.     }
  211.   }
  212.  
  213.   &.landscape {
  214.     .pages {
  215.       width: calc(2 * 166px);
  216.  
  217.       .page {
  218.         .layout-holder {
  219.           .preview {
  220.             width: 166px;
  221.             height: 117.3px;
  222.             padding: calc(1.6835017% / 2);
  223.  
  224.             .layout-item {
  225.               padding: calc(1.6835017% / 2);
  226.             }
  227.           }
  228.         }
  229.       }
  230.  
  231.       .page-controls {
  232.         transform: translate(calc(166.5px - 50%), 101.3px);
  233.       }
  234.     }
  235.  
  236.     &.page-view {
  237.       .pages {
  238.         width: min(100vw, 600px);
  239.         height: min(100vw, 600px);
  240.  
  241.         .page {
  242.           width: min(100vw, 600px);
  243.           height: min(100vw, 600px);
  244.           padding-bottom: 29.292929292%;
  245.  
  246.           .layout-holder {
  247.             .preview {
  248.               width: 100%;
  249.               height: 100%;
  250.               padding: calc(1.6835017% / 2);
  251.  
  252.               .layout-item {
  253.                 padding: calc(1.6835017% / 2);
  254.               }
  255.             }
  256.           }
  257.         }
  258.       }
  259.     }
  260.   }
  261.  
  262.   &.portrait {
  263.     .pages {
  264.       width: calc(2 * 166px);
  265.  
  266.       .page {
  267.         .layout-holder {
  268.           .preview {
  269.             width: 166px;
  270.             height: 235px;
  271.             padding: calc(2.3809524% / 2);
  272.  
  273.             .layout-item {
  274.               padding: calc(2.3809524% / 2);
  275.             }
  276.           }
  277.         }
  278.       }
  279.  
  280.  
  281.       .page-controls {
  282.         transform: translate(calc(166.5px - 50%), 219px);
  283.       }
  284.     }
  285.  
  286.     &.page-view {
  287.       .pages {
  288.         width: min(100vw, 600px);
  289.         height: min(100vw, 600px);
  290.  
  291.         .page {
  292.           width: min(100vw, 600px);
  293.           height: min(100vw, 600px);
  294.           padding: 0 calc(29.292929292% / 2);
  295.  
  296.           .layout-holder {
  297.             .preview {
  298.               width: 100%;
  299.               height: 100%;
  300.               padding: calc(2.3809524% / 2);
  301.  
  302.               .layout-item {
  303.                 padding: calc(2.3809524% / 2);
  304.               }
  305.             }
  306.           }
  307.         }
  308.       }
  309.     }
  310.   }
  311. }
  312.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement