Home.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="view-home">
  3. <div class="home-sections">
  4. <div class="home-library" @click="$router.push('/library')">
  5. <div class="wrapper" />
  6. <b-button :to="{ name: 'library' }" variant="dark">
  7. {{ $t('sections.library') }}
  8. </b-button>
  9. </div>
  10. <div class="home-kit" @click="$router.push('/kit')">
  11. <div class="wrapper" />
  12. <b-button :to="{ name: 'kit' }" variant="kit">
  13. {{ $t('sections.kit') }}
  14. </b-button>
  15. </div>
  16. <div class="home-creations" @click="$router.push('/gallery')">
  17. <div class="wrapper" />
  18. <b-button :to="{ name: 'gallery' }" variant="creation">
  19. {{ $t('sections.gallery') }}
  20. </b-button>
  21. <div
  22. v-for="(item, i) in [['top', 'left'], ['top', 'right'], ['bottom', 'right'], ['bottom', 'left']]" :key="i"
  23. class="home-creations-circle" :class="item"
  24. />
  25. </div>
  26. </div>
  27. <div v-if="visited === false" class="page-popup">
  28. <div class="page-popup-container h-100">
  29. <b-overlay :show="popup === undefined" z-index="0" class="h-100">
  30. <page-view
  31. v-if="popup"
  32. :page="popup" slug="welcome"
  33. @close="onPopupClose()"
  34. />
  35. </b-overlay>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. import { mapGetters } from 'vuex'
  42. import { PageView } from '@/components/layouts'
  43. export default {
  44. name: 'Home',
  45. components: {
  46. PageView
  47. },
  48. data () {
  49. return {
  50. popup: undefined
  51. }
  52. },
  53. computed: {
  54. ...mapGetters(['visited'])
  55. },
  56. methods: {
  57. onPopupClose () {
  58. this.$store.commit('SET_VISITED', true)
  59. }
  60. },
  61. async created () {
  62. if (this.visited === false) {
  63. this.popup = await this.$store.dispatch('QUERY_PAGE', 'welcome')
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .view-home {
  70. position: relative;
  71. &, .home-sections {
  72. width: 100%;
  73. height: 100%;
  74. }
  75. .home-sections > div {
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. position: relative;
  80. cursor: pointer;
  81. .wrapper {
  82. position: absolute;
  83. opacity: 0.5;
  84. height: 100%;
  85. width: 100%;
  86. pointer-events: none;
  87. }
  88. @include media-breakpoint-up($size-bp) {
  89. &:not(:hover) {
  90. .wrapper,
  91. .btn {
  92. display: none;
  93. }
  94. }
  95. }
  96. }
  97. @include media-breakpoint-down($size-bp-down) {
  98. .home-sections {
  99. display: flex;
  100. flex-direction: column;
  101. > div {
  102. height: 100%;
  103. }
  104. }
  105. }
  106. @include media-breakpoint-up($size-bp) {
  107. .home-sections {
  108. display: grid;
  109. grid-template: 'a b'
  110. 'a c';
  111. grid-template-rows: repeat(2, 1fr);
  112. grid-template-columns: repeat(2, 1fr);
  113. }
  114. .home-library {
  115. grid-area: a;
  116. }
  117. .home-kit {
  118. grid-area: b;
  119. }
  120. .home-creations {
  121. grid-area: c;
  122. }
  123. }
  124. .btn {
  125. font-family: $font-family-text;
  126. border-color: $black;
  127. padding: 0 1rem;
  128. font-size: 1.75rem;
  129. @include media-breakpoint-up($size-bp) {
  130. font-size: 2.5rem;
  131. }
  132. z-index: 1;
  133. }
  134. .home-library {
  135. background-image: url('~@/assets/imgs/home-library.svg');
  136. background-size: cover;
  137. background-position: center;
  138. border-bottom: $line;
  139. @include media-breakpoint-up($size-bp) {
  140. border-bottom: 0;
  141. border-right: $line;
  142. }
  143. .wrapper {
  144. background-color: $white;
  145. }
  146. }
  147. .home-kit {
  148. background-image: url('~@/assets/imgs/home-kit.svg');
  149. background-size: cover;
  150. .wrapper {
  151. background-color: lighten(theme-color('kit'), 15%);
  152. }
  153. }
  154. .home-creations {
  155. background-image: url('~@/assets/imgs/home-creations.svg');
  156. background-size: contain;
  157. background-position: center;
  158. background-repeat: no-repeat;
  159. border-top: $line;
  160. @include media-breakpoint-up($size-bp) {
  161. background-size: cover;
  162. }
  163. .wrapper {
  164. background-color: theme-color('creation');
  165. }
  166. &-circle {
  167. position: absolute;
  168. z-index: -1;
  169. width: 7vmin;
  170. height: 7vmin;
  171. background-color: #ccc;
  172. border-radius: 100%;
  173. @include media-breakpoint-up($size-bp) {
  174. width: 10vmin;
  175. height: 10vmin;
  176. }
  177. &.top {
  178. top: 0;
  179. }
  180. &.bottom {
  181. bottom: 0;
  182. }
  183. &.left {
  184. left: 0;
  185. }
  186. &.right {
  187. right: 0;
  188. }
  189. }
  190. }
  191. }
  192. .page-popup {
  193. border: $line;
  194. background-color: $white;
  195. position: absolute;
  196. width: 100%;
  197. z-index: 2;
  198. &-container {
  199. height: 100%;
  200. width: 100%;
  201. overflow-y: auto;
  202. }
  203. @include media-breakpoint-down($size-bp-down) {
  204. top: -2px;
  205. height: calc(100% + 2px);
  206. margin-bottom: -2px;
  207. }
  208. @include media-breakpoint-up($size-bp) {
  209. height: 80%;
  210. width: 80%;
  211. left: 10%;
  212. top: 50%;
  213. transform: translate(0, -50%);
  214. }
  215. }
  216. </style>