Comparatif.vue 7.7 KB

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