Comparatif.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <LayoutContainer>
  3. <v-row class="center-90">
  4. <table v-if="mdAndUp">
  5. <thead>
  6. <tr>
  7. <th />
  8. <th>
  9. <p class="standard">Standard</p>
  10. <p class="price">
  11. {{ standardPrice }} <span class="ttc">ttc</span>
  12. </p>
  13. <p class="month">/mois *</p>
  14. </th>
  15. <th class="premium-column">
  16. <p class="standard">Premium</p>
  17. <p class="price">
  18. {{ premiumPrice }} <span class="ttc">ttc</span>
  19. </p>
  20. <p class="month">/mois *</p>
  21. </th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. <tr v-for="item in items" :key="item.label">
  26. <td class="label-column">
  27. {{ item.label }}
  28. </td>
  29. <td>
  30. <v-icon
  31. v-if="item.includedInStandard === true"
  32. icon="far fa-check-circle"
  33. size="18"
  34. />
  35. <v-icon
  36. v-else-if="item.includedInStandard === false"
  37. icon="far fa-times-circle"
  38. size="18"
  39. color="red"
  40. />
  41. <span v-else>
  42. {{ item.includedInStandard }}
  43. </span>
  44. </td>
  45. <td>
  46. <v-icon
  47. v-if="item.includedInPremium === true"
  48. icon="far fa-check-circle"
  49. size="18"
  50. />
  51. <v-icon
  52. v-else-if="item.includedInPremium === false"
  53. icon="far fa-times-circle"
  54. size="18"
  55. color="red"
  56. />
  57. <span v-else>
  58. {{ item.includedInPremium }}
  59. </span>
  60. </td>
  61. </tr>
  62. </tbody>
  63. </table>
  64. <div v-else>
  65. <div class="d-flex flex-row flex-grow-1 justify-center mt-2">
  66. <v-btn
  67. :disabled="carouselPos === 0"
  68. icon="fas fa-chevron-left"
  69. class="mr-6"
  70. aria-label="Précédent"
  71. @click="goToPrevious"
  72. />
  73. <v-btn
  74. :disabled="carouselPos === 1"
  75. icon="fas fa-chevron-right"
  76. aria-label="Suivant"
  77. @click="goToNext"
  78. />
  79. </div>
  80. <v-carousel
  81. v-model="carouselPos"
  82. :hide-delimiters="true"
  83. :show-arrows="false"
  84. :height="height"
  85. >
  86. <v-carousel-item>
  87. <h4>Standard</h4>
  88. <div>
  89. <p class="from">À partir de</p>
  90. <p class="price">
  91. {{ standardPrice }} <span class="ttc">ttc</span>
  92. <span class="month">/mois</span>
  93. </p>
  94. </div>
  95. <table>
  96. <tbody>
  97. <tr v-for="item in items" :key="item.label">
  98. <td class="label-column">
  99. {{ item.label }}
  100. </td>
  101. <td>
  102. <v-icon
  103. v-if="item.includedInStandard === true"
  104. icon="far fa-check-circle"
  105. size="18"
  106. />
  107. <v-icon
  108. v-else-if="item.includedInStandard === false"
  109. icon="far fa-times-circle"
  110. size="18"
  111. color="red"
  112. />
  113. <span v-else>
  114. {{ item.includedInStandard }}
  115. </span>
  116. </td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. </v-carousel-item>
  121. <v-carousel-item>
  122. <h4>Premium</h4>
  123. <div>
  124. <p class="from">À partir de</p>
  125. <p class="price">
  126. {{ premiumPrice }} <span class="ttc">ttc</span>
  127. <span class="month">/mois</span>
  128. </p>
  129. </div>
  130. <table>
  131. <tbody>
  132. <tr v-for="item in items" :key="item.label">
  133. <td class="label-column">
  134. {{ item.label }}
  135. </td>
  136. <td>
  137. <v-icon
  138. v-if="item.includedInPremium === true"
  139. icon="far fa-check-circle"
  140. size="18"
  141. />
  142. <v-icon
  143. v-else-if="item.includedInPremium === false"
  144. icon="far fa-times-circle"
  145. size="18"
  146. color="red"
  147. />
  148. <span v-else>
  149. {{ item.includedInPremium }}
  150. </span>
  151. </td>
  152. </tr>
  153. </tbody>
  154. </table>
  155. </v-carousel-item>
  156. </v-carousel>
  157. </div>
  158. <div class="asterisk">
  159. <span>* Payable annuellement</span>
  160. </div>
  161. </v-row>
  162. </LayoutContainer>
  163. </template>
  164. <script setup lang="ts">
  165. import { useDisplay } from 'vuetify'
  166. import type { PropType } from 'vue'
  167. import type { ComparisonItem } from '~/types/interface'
  168. const { mdAndUp } = useDisplay()
  169. const props = defineProps({
  170. standardPrice: {
  171. type: String,
  172. required: true,
  173. },
  174. premiumPrice: {
  175. type: String,
  176. required: true,
  177. },
  178. items: {
  179. type: Array as PropType<Array<ComparisonItem>>,
  180. required: true,
  181. },
  182. })
  183. const height = computed(() => 150 + props.items.length * 48)
  184. const carouselPos = ref(0)
  185. const goToPrevious = () => {
  186. carouselPos.value = 0
  187. }
  188. const goToNext = () => {
  189. carouselPos.value = 1
  190. }
  191. </script>
  192. <style scoped lang="scss">
  193. .v-row {
  194. align-items: center;
  195. display: flex;
  196. flex-direction: row;
  197. justify-content: center;
  198. }
  199. table {
  200. width: 70%;
  201. margin-top: 1rem;
  202. margin-right: auto;
  203. margin-left: auto;
  204. border: none;
  205. border-collapse: collapse;
  206. @media (max-width: 940px) {
  207. width: 100%;
  208. }
  209. }
  210. th {
  211. height: 8rem;
  212. font-weight: 400;
  213. font-size: 30px;
  214. line-height: 34px;
  215. @media (max-width: 600px) {
  216. font-size: 18px;
  217. }
  218. }
  219. tr {
  220. height: 3rem;
  221. text-align: center;
  222. }
  223. tbody tr:nth-child(even) {
  224. background-color: var(--secondary-color);
  225. }
  226. td {
  227. padding-right: 5rem;
  228. @media (max-width: 600px) {
  229. padding-right: 0;
  230. }
  231. }
  232. td:first-child {
  233. text-align: left;
  234. padding-left: 20px;
  235. font-weight: 600;
  236. font-size: 12px;
  237. line-height: 16px;
  238. letter-spacing: 0.18em;
  239. text-transform: uppercase;
  240. color: var(--on-neutral-color-alt);
  241. @media (max-width: 600px) {
  242. padding-left: 5px;
  243. }
  244. }
  245. .standard {
  246. font-weight: 600;
  247. font-size: 12px;
  248. line-height: 16px;
  249. text-align: center;
  250. letter-spacing: 0.18em;
  251. text-transform: uppercase;
  252. padding-right: 5rem;
  253. margin-bottom: 1rem;
  254. }
  255. .ttc {
  256. font-weight: 300;
  257. font-size: 12px;
  258. line-height: 14px;
  259. text-align: center;
  260. color: var(--on-neutral-color-alt);
  261. padding-right: 5rem;
  262. }
  263. .ttc {
  264. text-transform: uppercase;
  265. }
  266. .price,
  267. .month {
  268. font-size: 30px;
  269. line-height: 34px;
  270. text-align: center;
  271. color: var(--on-neutral-color-alt);
  272. }
  273. .month {
  274. padding-right: 5rem;
  275. @media (max-width: 600px) {
  276. padding-right: 0;
  277. }
  278. }
  279. .v-carousel {
  280. h4 {
  281. text-align: center;
  282. margin: 24px auto 12px auto;
  283. text-transform: uppercase;
  284. letter-spacing: 0.25em;
  285. }
  286. p {
  287. padding-right: 0;
  288. }
  289. .price {
  290. margin-top: 12px;
  291. }
  292. .ttc {
  293. padding-right: 10px;
  294. }
  295. }
  296. .asterisk {
  297. display: flex;
  298. margin: 4px auto 0 auto;
  299. width: 70%;
  300. justify-content: flex-end;
  301. font-style: italic;
  302. }
  303. </style>