Blame view

src/components/widgets/card/NameCard.vue 2.63 KB
ade01719f   Jatinder Singh   change
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
  <template>
  <div class="name-card">
    <v-card :color="color" ref="card" :dark="dark" :img="cardBgImage">
      <v-card-media v-if="showTopNav">
        <v-layout row justify-space-between class="ma-0">
          <v-flex xs2>
            <v-icon color="pink">favorite</v-icon>
          </v-flex>
          <v-flex xs2 class="text-sm-right">
            <v-icon>more_vert</v-icon>
          </v-flex>
        </v-layout>
      </v-card-media>    
      <v-card-text>
        <div class="layout ma-0 align-center" :class="computeCardLayout">
          <v-avatar :size="computeAvatarSize" color="primary">
            <img v-bind:src="avatar.src" v-bind:alt="name" v-if="showAvatar">
            <span v-else class="white--text headline">{{ name.charAt(0) }}</span>
          </v-avatar>
          <div class="flex" :class="computeTextAlgin">
            <div class="subheading">{{name}}</div>
            <span class="caption">{{jobTitle}}</span>
          </div>
        </div>
      </v-card-text>
    </v-card>
    <v-bottom-nav :value="true" color="transparent" :height="64" v-if="showBottomNav">
      <v-btn flat color="teal" value="recent">
        <span>Recent</span>
        <v-icon>history</v-icon>
      </v-btn>
      <v-btn flat color="teal" value="favorites">
        <span>Favorites</span>
        <v-icon>favorite</v-icon>
      </v-btn>
      <v-btn flat color="teal" value="nearby">
        <span>Nearby</span>
        <v-icon>place</v-icon>
      </v-btn>
    </v-bottom-nav>   
  </div>
  </template>
  
  <script>
  export default {
    props: {
      name: {
        type: String,
        default: ''
      },
      avatar: {
        type: Object,
        default: null
      },
      jobTitle: {
        type: String,
        default: ''
      },
      cardBgImage: {
        type: String,
      },
      color: {
        type: String,
        default: ''
      },
      dark: {
        type: Boolean,
        default: false
      },
      bottomNav: {
        type: Boolean,
        default: false
      },    
      topNav: {
        type: Boolean,
        default: false
      },      
      mini: {
        type: Boolean,
        default: false
      }    
    },
    data: () => ({
  
    }),
    
    computed: {
      computeCardLayout () {
        return (this.mini) ? 'row' : 'column';
      },
      computeTextAlgin () {
        return (this.mini) ? 'text-sm-right' : 'text-sm-center';
      },
      computeAvatarSize () {
        return (this.mini) ? '48' : '96';
      },
      showAvatar () {
        return this.avatar !== null && this.avatar.src;
      },
  
      showBottomNav () {
        return (this.mini === false && this.bottomNav); 
      },
  
      showTopNav () {
        return (this.mini === false && this.topNav); 
      }
    },
  
    methods: {
  
    },
  
  
  };
  </script>
  
  <style lang="stylus" scoped>
    .caption, .subheading {
      font-weight:200;  
    }
  </style>