Sfoglia il codice sorgente

cards are rendered in a stack

tags/0.0.1
diaseu 4 anni fa
parent
commit
70c0ccd11c

+ 2
- 3
backend/db/data-generator/index.js Vedi File

70
 
70
 
71
         var mediaArray = []
71
         var mediaArray = []
72
         for (let i=0; i < 3; i++) {
72
         for (let i=0; i < 3; i++) {
73
-            
73
+            mediaArray.push(random.media())
74
         }
74
         }
75
-
76
-        user.user_media = random.media()
75
+        user.user_media = mediaArray
77
     })
76
     })
78
     console.log('COMPLETED: Generated Users...')
77
     console.log('COMPLETED: Generated Users...')
79
     return users
78
     return users

+ 2
- 2
backend/db/data-generator/random.js Vedi File

30
     }
30
     }
31
     return str
31
     return str
32
 }
32
 }
33
-const randomMedia = max => {
33
+const randomMedia = () => {
34
     const stockimg = [
34
     const stockimg = [
35
         'https://i.imgur.com/a4wirDS.png',
35
         'https://i.imgur.com/a4wirDS.png',
36
         'https://i.imgur.com/F6GxGXG.jpeg',
36
         'https://i.imgur.com/F6GxGXG.jpeg',
40
         'https://i.imgur.com/rOjRCgo.jpeg',
40
         'https://i.imgur.com/rOjRCgo.jpeg',
41
         'https://i.imgur.com/FwSdQww.jpeg',
41
         'https://i.imgur.com/FwSdQww.jpeg',
42
         'https://i.imgur.com/JjZyzXL.jpeg',
42
         'https://i.imgur.com/JjZyzXL.jpeg',
43
-
43
+        'https://i.imgur.com/1DsSQ1s.jpeg',
44
     ]
44
     ]
45
     return randomValFrom(stockimg)
45
     return randomValFrom(stockimg)
46
 }
46
 }

+ 21
- 4
frontend/src/components/ProfileCardList.vue Vedi File

6
             :key='profile.profile_id'
6
             :key='profile.profile_id'
7
             @throwout='swipped(profile)'
7
             @throwout='swipped(profile)'
8
             v-for='profile in profiles'
8
             v-for='profile in profiles'
9
+            :style='{ "left": `vh` }'
9
         )
10
         )
10
             .card.b-solid.rounded.p-0.bg-cover(
11
             .card.b-solid.rounded.p-0.bg-cover(
11
                 :style='{ "background-image": `url(${profile.user.user_media})` }'
12
                 :style='{ "background-image": `url(${profile.user.user_media})` }'
17
 </template>
18
 </template>
18
 
19
 
19
 <script>
20
 <script>
20
-
21
-
22
 export default {
21
 export default {
23
     name: 'ProfileCardList',
22
     name: 'ProfileCardList',
24
     props: {
23
     props: {
77
 }
76
 }
78
 </script>
77
 </script>
79
 <style lang="postcss">
78
 <style lang="postcss">
80
-.profile_card_list_container
79
+@import '../sss/card.scss'
80
+
81
+.profile_card_list
81
     display: flex
82
     display: flex
82
     justify-content: center
83
     justify-content: center
83
     margin: 5vh 0 0 0
84
     margin: 5vh 0 0 0
85
+    position: relative
86
+
87
+
88
+.profile_card_list_container
89
+    margin: 0 auto
90
+    width: 30%
91
+    position: relative
92
+    .swipe
93
+        list-style: none
94
+        background: #fff
95
+        box-shadow: 0 0 2px rgba(0,0,0,.2), 1px 1px 1px rgba(0,0,0,.2)
96
+        position: absolute
97
+        line-height: 300px
98
+        text-align: center
99
+        border: 1px solid #ECECEC
100
+        border-radius: 8px
101
+        
84
 
102
 
85
 .swipe
103
 .swipe
86
     
104
     
92
     max-width: 85vw
110
     max-width: 85vw
93
     height: 50vh
111
     height: 50vh
94
     background-position: center
112
     background-position: center
95
-    border-radius: 3vh
96
     border: 1px solid #fff
113
     border: 1px solid #fff
97
     &_content
114
     &_content
98
         width: 100%
115
         width: 100%

+ 18
- 0
frontend/src/sss/card.scss Vedi File

1
+$n: 100;
2
+$cardbase: 2px;
3
+$cardtop: -1px;
4
+$index: 9999;
5
+
6
+@for $i from 0 through $n {
7
+  .swipe:nth-child(#{$i}) {
8
+    position: absolute;
9
+    left: calc($cardbase * $i);
10
+    top: calc($cardtop * $i);
11
+    z-index: calc($index - $i);
12
+  }
13
+}
14
+
15
+
16
+.swipe .card h3 {
17
+    color: blue!important;
18
+}

Loading…
Annulla
Salva