Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //App.vue
  2. <template>
  3.   <div id="app">
  4.     <nav class="navbar">
  5.       <a href="/" class="navbar__header">
  6.         <img src="./assets/logo.png" alt="CoinCap" class="navbar__logo">
  7.         <span>CoinCap Display</span>
  8.       </a>
  9.     </nav>
  10.  
  11.     <CurrencyTable/>
  12.   </div>
  13. </template>
  14.  
  15. <script>
  16. import CurrencyTable from "./components/CurrencyTable.vue";
  17.  
  18. export default {
  19.   name: "app",
  20.   components: {
  21.     CurrencyTable
  22.   }
  23. };
  24. </script>
  25.  
  26. <style lang="scss">
  27. @import url('https://fonts.googleapis.com/css?family=Raleway:700|Roboto&display=swap');
  28.  
  29. $color-primary-900: hsl(159, 70, 19);
  30. $color-primary-700: hsl(159, 70, 39);
  31. $color-primary-500: hsl(159, 70, 62);
  32. $color-primary-300: hsl(159, 70, 77);
  33. $color-primary-100: hsl(159, 70, 92);
  34.  
  35. $color-text: #333;
  36.  
  37. body {
  38.   font-family: 'Roboto', Arial, sans-serif;
  39.   max-width: 1200px;
  40.   box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
  41.   min-height: 100vh;
  42.   margin: auto;
  43.   color: $color-text;
  44. }
  45.  
  46. .navbar {
  47.   border-radius: 0 0 5px 5px;
  48.   background: $color-primary-500;
  49.   box-shadow: 0 3px 3px rgba(0, 0, 0, 0.1);
  50.  
  51.   &__logo {
  52.     display: inline-block;
  53.     max-height: 50px;
  54.     padding: 1rem;
  55.     padding-left: 3rem;
  56.     vertical-align: middle;
  57.   }
  58.  
  59.   &__header {
  60.     text-decoration: none;
  61.     color: $color-text;
  62.     font-family: 'Raleway', Arial, sans-serif;
  63.     font-size: 1.5rem;
  64.     line-height: 50px;
  65.     padding: 1rem 0;
  66.     vertical-align: middle;
  67.   }
  68. }
  69.  
  70. </style>
  71.  
  72.  
  73. //CurrencyTable.vue
  74. <template>
  75.     <div class="table">
  76.         <div class="table__row table__row_header">
  77.             <div class="table__cell table__cell_header">Name</div>
  78.             <div class="table__cell table__cell_header">Price</div>
  79.             <div class="table__cell table__cell_header">Market Cap</div>
  80.             <div class="table__cell table__cell_header">Volume (24h)</div>
  81.         </div>
  82.  
  83.         <ul class="table__body">
  84.             <li class="table__row">
  85.                 <div class="table__cell table__cell_body">Bitcoin</div>
  86.                 <div class="table__cell table__cell_body">$9,716</div>
  87.                 <div class="table__cell table__cell_body">$173.24b</div>
  88.                 <div class="table__cell table__cell_body">$6.55b</div>
  89.             </li>
  90.             <li class="table__row">
  91.                 <div class="table__cell table__cell_body">Ethereum</div>
  92.                 <div class="table__cell table__cell_body">$206.90</div>
  93.                 <div class="table__cell table__cell_body">$22.14b</div>
  94.                 <div class="table__cell table__cell_body">$2.31b</div>
  95.             </li>
  96.             <li class="table__row">
  97.                 <div class="table__cell table__cell_body">Ethereum</div>
  98.                 <div class="table__cell table__cell_body">$206.90</div>
  99.                 <div class="table__cell table__cell_body">$22.14b</div>
  100.                 <div class="table__cell table__cell_body">$2.31b</div>
  101.             </li>
  102.             <li class="table__row">
  103.                 <div class="table__cell table__cell_body">Ethereum</div>
  104.                 <div class="table__cell table__cell_body">$206.90</div>
  105.                 <div class="table__cell table__cell_body">$22.14b</div>
  106.                 <div class="table__cell table__cell_body">$2.31b</div>
  107.             </li>
  108.             <li class="table__row">
  109.                 <div class="table__cell table__cell_body">Ethereum</div>
  110.                 <div class="table__cell table__cell_body">$206.90</div>
  111.                 <div class="table__cell table__cell_body">$22.14b</div>
  112.                 <div class="table__cell table__cell_body">$2.31b</div>
  113.             </li>
  114.         </ul>
  115.     </div>
  116. </template>
  117.  
  118. <script>
  119. export default {
  120.  
  121. }
  122. </script>
  123.  
  124. <style lang="scss">
  125. $color-primary-900: hsl(159, 70, 19);
  126. $color-primary-300: hsl(159, 70, 77);
  127. $color-primary-100: hsl(159, 70, 92);
  128.  
  129. .table {
  130.     max-width: 100%;
  131.     width: 60%;
  132.     margin: 10vh auto 0;
  133.  
  134.     &__body {
  135.         list-style-type: none;
  136.         padding: 0;
  137.         max-height: 25vh;
  138.         overflow: hidden;
  139.         overflow-y: scroll;
  140.         padding: 10px;
  141.         padding-right: 5px;
  142.  
  143.         &::-webkit-scrollbar {
  144.             width: 5px;
  145.         }
  146.  
  147.         &:hover::-webkit-scrollbar-thumb {
  148.             background: rgba($color-primary-900, 0.3);
  149.             border-radius: 5px;
  150.         }
  151.     }
  152.  
  153.     &__row {
  154.         display: flex;
  155.         box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  156.         border-radius: 0.25rem;
  157.  
  158.         &_header {
  159.             background: $color-primary-300;
  160.         }
  161.  
  162.         &:not(&_header):hover {
  163.             background: $color-primary-100;
  164.         }
  165.  
  166.         &:not(:last-of-type) {
  167.             margin-bottom: 1rem;
  168.         }
  169.     }
  170.  
  171.     &__cell {
  172.         flex-basis: 25%;
  173.         padding: 0.5rem;
  174.  
  175.         &_header {
  176.             font-family: 'Raleway', sans-serif;
  177.             font-weight: bold;
  178.         }
  179.     }
  180. }
  181.  
  182. @media (max-width: 767px) {
  183.     .table {
  184.         &__cell {
  185.             flex-basis: 50%;
  186.  
  187.             &:nth-of-type(n+3) {
  188.                 display: none;
  189.             }
  190.         }
  191.     }
  192. }
  193. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement