123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <div class="col-12 col-md-6 col-xl-4 group-card">
- <div class="group-card-inner">
- <img
- v-if="group.metadata && group.metadata.hasOwnProperty('header')"
- :src="group.metadata.header.url"
- class="group-header-img" />
- <div
- v-else
- class="group-header-img"
- :class="{ compact: compact }">
- <div
- class="bg-light d-flex align-items-center justify-content-center rounded"
- style="width: 100%; height:100%;">
- </div>
- </div>
- <div class="group-card-inner-copy">
- <p class="font-weight-bold mb-0 text-dark" style="font-size: 16px;">
- {{ truncate(group.name || 'Untitled Group', titleLength) }}
- </p>
- <p class="text-muted mb-1" style="font-size: 12px;">
- {{ truncate(group.short_description, descriptionLength) }}
- </p>
- <p v-if="showStats" class="mb-0 small text-lighter">
- <span>
- <i class="fal fa-users"></i>
- <span class="small font-weight-bold">{{ prettyCount(group.member_count) }}</span>
- </span>
- <span v-if="!group.local" class="remote-label ml-3">
- <i class="fal fa-globe"></i> Remote
- </span>
- </p>
- </div>
- <div class="group-card-inner-foaf">
- </div>
- <div class="group-card-inner-cta">
- <router-link :to="`/groups/${group.id}`" class="btn btn-light btn-block font-weight-bold">
- Join Group
- </router-link>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- props: {
- group: {
- type: Object
- },
- compact: {
- type: Boolean,
- default: false
- },
- showStats: {
- type: Boolean,
- default: true
- },
- truncateTitleLength: {
- type: Number,
- default: 19
- },
- truncateDescriptionLength: {
- type: Number,
- default: 22
- }
- },
- data() {
- return {
- titleLength: 40,
- descriptionLength: 60
- }
- },
- mounted() {
- if(this.compact) {
- this.titleLength = 19;
- this.descriptionLength = 22;
- }
- if(this.truncateTitleLength != 19) {
- this.titleLength = this.truncateTitleLength;
- }
- if(this.truncateDescriptionLength != 22) {
- this.descriptionLength = this.truncateDescriptionLength;
- }
- },
- methods: {
- prettyCount(val) {
- return App.util.format.count(val);
- },
- truncate(str, limit = 140) {
- if(str.length <= limit) {
- return str;
- }
- return str.substr(0, limit) + ' ...';
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .group-card {
- margin-bottom: 15px;
- &-inner {
- display: flex;
- flex-direction: column;
- border: 1px solid var(--border-color);
- border-radius: 10px;
- overflow: hidden;
- &-copy {
- background-color: var(--light);
- padding: 1rem;
- }
- &-foaf {
- background-color: var(--light);
- height: 30px;
- }
- &-cta {
- background-color: var(--light);
- padding: 1rem;
- }
- }
- .member-label {
- padding: 2px 5px;
- font-size: 9px;
- color: rgba(75, 119, 190, 1);
- background: rgba(137, 196, 244, 0.2);
- border: 1px solid rgba(137, 196, 244, 0.3);
- font-weight: 500;
- text-transform: capitalize;
- border-radius: 3px;
- }
- .remote-label {
- padding: 2px 5px;
- font-size: 9px;
- color: #B45309;
- background: #FEF3C7;
- border: 1px solid #FCD34D;
- font-weight: 500;
- text-transform: capitalize;
- border-radius: 3px;
- }
- .group-header-img {
- width: 100%;
- height: 150px;
- object-fit: cover;
- padding: 0px;
- overflow: hidden;
- }
- }
- </style>
|