2019-10-05 19:17:18 +00:00
|
|
|
<docs>
|
|
|
|
### EventCard
|
|
|
|
|
|
|
|
A simple card for an event
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<EventCard
|
|
|
|
:event="{
|
|
|
|
title: 'Vue Styleguidist first meetup: learn the basics!',
|
|
|
|
beginsOn: new Date(),
|
|
|
|
tags: [
|
|
|
|
{
|
|
|
|
slug: 'test', title: 'Test'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
slug: 'mobilizon', title: 'Mobilizon'
|
|
|
|
},
|
|
|
|
],
|
|
|
|
organizerActor: {
|
|
|
|
preferredUsername: 'tcit',
|
|
|
|
name: 'Some Random Dude',
|
|
|
|
domain: null
|
|
|
|
}
|
|
|
|
}"
|
|
|
|
/>
|
|
|
|
```
|
|
|
|
</docs>
|
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
<template>
|
2019-04-03 15:29:03 +00:00
|
|
|
<router-link class="card" :to="{ name: 'Event', params: { uuid: event.uuid } }">
|
2019-10-14 09:41:57 +00:00
|
|
|
<div class="card-image">
|
|
|
|
<figure class="image is-16by9" :style="`background-image: url('${event.picture ? event.picture.url : '/img/mobilizon_default_card.png'}')`">
|
2019-05-22 12:12:11 +00:00
|
|
|
<div class="tag-container" v-if="event.tags">
|
2019-04-24 18:49:52 +00:00
|
|
|
<b-tag v-for="tag in event.tags.slice(0, 3)" :key="tag.slug" type="is-secondary">{{ tag.title }}</b-tag>
|
|
|
|
</div>
|
2019-01-21 14:08:22 +00:00
|
|
|
</figure>
|
|
|
|
</div>
|
2019-04-03 15:29:03 +00:00
|
|
|
<div class="content">
|
|
|
|
<div class="title-wrapper">
|
|
|
|
<div class="date-component">
|
|
|
|
<date-calendar-icon v-if="!mergedOptions.hideDate" :date="event.beginsOn" />
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
2019-04-03 15:29:03 +00:00
|
|
|
<h2 class="title" ref="title">{{ event.title }}</h2>
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
2019-10-02 15:59:07 +00:00
|
|
|
<span class="organizer-place-wrapper">
|
2019-09-20 17:43:29 +00:00
|
|
|
<span v-if="actorDisplayName && actorDisplayName !== '@'">{{ $t('By {name}', { name: actorDisplayName }) }}</span>
|
|
|
|
<span v-if="event.physicalAddress && (event.physicalAddress.locality || event.physicalAddress.description)">
|
2019-10-10 11:48:03 +00:00
|
|
|
{{ event.physicalAddress.locality || event.physicalAddress.description }}
|
2019-09-20 17:43:29 +00:00
|
|
|
</span>
|
2019-04-03 15:29:03 +00:00
|
|
|
</span>
|
2019-01-21 14:08:22 +00:00
|
|
|
</div>
|
2019-04-03 15:29:03 +00:00
|
|
|
<!-- <div v-if="!mergedOptions.hideDetails" class="details">-->
|
|
|
|
<!-- <div v-if="event.participants.length > 0 &&-->
|
|
|
|
<!-- mergedOptions.loggedPerson &&-->
|
|
|
|
<!-- event.participants[0].actor.id === mergedOptions.loggedPerson.id">-->
|
|
|
|
<!-- <b-tag type="is-info"><translate>Organizer</translate></b-tag>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else-if="event.participants.length === 1">-->
|
|
|
|
<!-- <translate-->
|
|
|
|
<!-- :translate-params="{name: event.participants[0].actor.preferredUsername}"-->
|
2019-09-12 09:34:01 +00:00
|
|
|
<!-- >{name} organizes this event</translate>-->
|
2019-04-03 15:29:03 +00:00
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div v-else>-->
|
|
|
|
<!-- <span v-for="participant in event.participants" :key="participant.actor.uuid">-->
|
|
|
|
<!-- {{ participant.actor.preferredUsername }}-->
|
|
|
|
<!-- <span v-if="participant.role === ParticipantRole.CREATOR">(organizer)</span>,-->
|
|
|
|
<!-- <!– <translate-->
|
|
|
|
<!-- :translate-params="{name: participant.actor.preferredUsername}"-->
|
2019-09-12 09:34:01 +00:00
|
|
|
<!-- > {name} is in,</translate>–>-->
|
2019-04-03 15:29:03 +00:00
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
</router-link>
|
2019-01-21 14:08:22 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-10-13 14:24:43 +00:00
|
|
|
import { IEvent, IEventCardOptions, ParticipantRole } from '@/types/event.model';
|
2019-03-22 09:57:14 +00:00
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
2019-04-03 15:29:03 +00:00
|
|
|
import DateCalendarIcon from '@/components/Event/DateCalendarIcon.vue';
|
2019-10-13 14:24:43 +00:00
|
|
|
import { Person } from '@/types/actor';
|
2019-01-21 14:08:22 +00:00
|
|
|
|
2019-03-21 19:23:42 +00:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-04-03 15:29:03 +00:00
|
|
|
DateCalendarIcon,
|
2019-03-21 19:23:42 +00:00
|
|
|
},
|
|
|
|
})
|
2019-01-21 14:08:22 +00:00
|
|
|
export default class EventCard extends Vue {
|
|
|
|
@Prop({ required: true }) event!: IEvent;
|
2019-04-03 15:29:03 +00:00
|
|
|
@Prop({ required: false }) options!: IEventCardOptions;
|
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
|
|
|
|
|
|
|
defaultOptions: IEventCardOptions = {
|
|
|
|
hideDate: false,
|
|
|
|
loggedPerson: false,
|
|
|
|
hideDetails: false,
|
|
|
|
organizerActor: null,
|
|
|
|
};
|
|
|
|
|
|
|
|
get mergedOptions(): IEventCardOptions {
|
|
|
|
return { ...this.defaultOptions, ...this.options };
|
|
|
|
}
|
2019-02-07 15:37:40 +00:00
|
|
|
|
2019-04-24 18:49:52 +00:00
|
|
|
get actorDisplayName(): string {
|
2019-04-03 15:29:03 +00:00
|
|
|
const actor = Object.assign(new Person(), this.event.organizerActor || this.mergedOptions.organizerActor);
|
|
|
|
return actor.displayName();
|
2019-02-07 15:37:40 +00:00
|
|
|
}
|
2019-04-03 15:29:03 +00:00
|
|
|
|
2019-01-21 14:08:22 +00:00
|
|
|
}
|
|
|
|
</script>
|
2019-04-03 15:29:03 +00:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "../../variables";
|
|
|
|
|
|
|
|
a.card {
|
2019-10-07 14:48:13 +00:00
|
|
|
display: block;
|
2019-04-03 15:29:03 +00:00
|
|
|
background: $secondary;
|
|
|
|
|
2019-10-07 14:48:13 +00:00
|
|
|
&:hover {
|
|
|
|
// box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
transform: scale(1.01, 1.01);
|
|
|
|
&:after {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
border-radius: 5px;
|
|
|
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
|
|
transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: "";
|
|
|
|
border-radius: 5px;
|
|
|
|
position: absolute;
|
|
|
|
z-index: -1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
|
|
|
opacity: 0;
|
|
|
|
transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
|
|
|
}
|
|
|
|
|
2019-04-24 18:49:52 +00:00
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -5px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
|
|
|
|
|
|
|
span.tag {
|
|
|
|
margin: 5px auto;
|
|
|
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
/*word-break: break-all;*/
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
/*text-align: right;*/
|
|
|
|
font-size: 1em;
|
|
|
|
/*padding: 0 1px;*/
|
|
|
|
line-height: 1.75em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-03 15:29:03 +00:00
|
|
|
div.card-image {
|
|
|
|
background: $secondary;
|
2019-10-14 09:41:57 +00:00
|
|
|
|
|
|
|
figure.image {
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
}
|
2019-04-03 15:29:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
div.content {
|
|
|
|
padding: 5px;
|
|
|
|
background: $secondary;
|
|
|
|
|
|
|
|
div.title-wrapper {
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
div.date-component {
|
|
|
|
flex: 0;
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
2019-10-07 14:48:13 +00:00
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
2019-04-03 15:29:03 +00:00
|
|
|
font-weight: 400;
|
2019-10-14 11:03:48 +00:00
|
|
|
font-size: 1.4em;
|
2019-10-02 15:59:07 +00:00
|
|
|
margin-top: auto;
|
2019-10-14 11:03:48 +00:00
|
|
|
min-height: 3.4rem;
|
2019-10-02 15:59:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
span.organizer-place-wrapper {
|
|
|
|
display: flex;
|
2019-10-10 11:48:03 +00:00
|
|
|
padding: 0 0.5rem 0.3rem;
|
|
|
|
|
|
|
|
span {
|
|
|
|
padding-right: 0.25rem;
|
|
|
|
}
|
2019-10-02 15:59:07 +00:00
|
|
|
|
2019-10-14 11:03:48 +00:00
|
|
|
span:not(:last-child):after {
|
|
|
|
content: '-';
|
|
|
|
padding-left: 0.25rem;
|
|
|
|
}
|
|
|
|
|
2019-10-02 15:59:07 +00:00
|
|
|
span:last-child {
|
|
|
|
flex: 1;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2019-04-03 15:29:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|