Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

ProfileCard.vue 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="tinder__card">
  3. <div class="tinder__card__container">
  4. <div
  5. v-for="user in users"
  6. :key="user.id"
  7. @throwout="swipped(user)"
  8. :config="config"
  9. class="swipe"
  10. >
  11. <div
  12. class="card"
  13. :style="{ 'background-image': `url(${user.avatar})` }"
  14. >
  15. <div class="card__content">
  16. <h3>{{ user.name }}</h3>
  17. </div>
  18. </div>
  19. </div>
  20. <div class="swipe__icons">// Icons</div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. export default {
  26. name: 'tinder-cards',
  27. props: {
  28. users: {
  29. type: [Object, Array],
  30. default: function () {
  31. return [
  32. {
  33. uid: '1',
  34. name: 'Fullname',
  35. avatar: 'https://hips.hearstapps.com/hmg-prod.s3.amazonaws.com/images/newborn-baby-boy-sleeping-peacefully-wearing-knit-royalty-free-image-1589459736.jpg?crop=0.669xw:1.00xh;0.228xw,0&resize=640:*',
  36. metadata: { age: '21', rawMetadata: 'Some Text Here!' },
  37. },
  38. ]
  39. },
  40. },
  41. uid: {
  42. type: String,
  43. },
  44. },
  45. data() {
  46. return {
  47. config: {
  48. // allowedDirections: [VueSwing.Direction.LEFT, VueSwing.Direction.RIGHT],
  49. minThrowOutDistance: 250,
  50. maxThrowOutDistance: 300,
  51. },
  52. favorites: [],
  53. requests: [],
  54. }
  55. },
  56. created() {
  57. this.getUser()
  58. },
  59. components: {},
  60. methods: {
  61. logOut() {},
  62. reject() {
  63. this.swipped(this.currentCard)
  64. },
  65. swipped(user) {
  66. const index = this.users.findIndex(u => u.uid == user.uid)
  67. this.users.splice(index, 1)
  68. user.id = Date.now() + (Math.random() * 100000).toFixed()
  69. this.users.unshift({ ...user })
  70. },
  71. getUser() {
  72. return
  73. },
  74. onRequest() {
  75. const data = { ...this.currentCard }
  76. return
  77. },
  78. },
  79. computed: {
  80. currentCard() {
  81. return this.users[this.users.length - 1]
  82. },
  83. },
  84. }
  85. </script>
  86. <style lang="postcss">
  87. .card
  88. position: relative
  89. background-color: #fff
  90. width: 250px
  91. padding: 20px
  92. max-width: 85vw
  93. height: 50vh
  94. border-radius: 9px
  95. background-size: cover
  96. background-position: center
  97. .tinder__card__container
  98. display: flex
  99. justify-content: center
  100. margin-top: 10vh
  101. .swipe
  102. position: absolute
  103. .card__content
  104. width: 100%
  105. height: 100%
  106. .card h3
  107. position: absolute
  108. bottom: 0
  109. margin: 10px
  110. color: #fff
  111. background: linear-gradient(
  112. 109deg,
  113. rgba(0, 0, 0, 0.5) 0%,
  114. rgba(0, 0, 0, 0) 100%
  115. )
  116. border-radius: 9px
  117. padding: 5px
  118. .swipe__icons__container
  119. display: flex
  120. justify-content: center
  121. .swipe__icons
  122. position: fixed
  123. bottom: 5vh
  124. display: flex
  125. width: 250px
  126. justify-content: space-evenly
  127. .swipe__icon__close:hover,
  128. .swipe__icon__star:hover,
  129. .swipe__icon__heart:hover
  130. transform: scale(1.06)
  131. transition: all 0.2s ease-in-out
  132. .swipe__icons .material-design-icon__svg
  133. background-color: white
  134. box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.2) !important
  135. border-radius: 30px
  136. padding: 10px
  137. @media only screen and (min-width: 768px)
  138. .swipe__icon__power
  139. display: none
  140. </style>