2019-10-05 21:17:18 +02:00
|
|
|
<docs>
|
|
|
|
### EventCard
|
|
|
|
|
|
|
|
A simple card for an event
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<EventCard
|
2020-02-18 08:57:00 +01:00
|
|
|
:event="{
|
2019-10-05 21:17:18 +02:00
|
|
|
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 15:08:22 +01:00
|
|
|
<template>
|
2019-04-03 17:29:03 +02:00
|
|
|
<router-link class="card" :to="{ name: 'Event', params: { uuid: event.uuid } }">
|
2019-10-14 11:41:57 +02:00
|
|
|
<div class="card-image">
|
2020-02-18 08:57:00 +01:00
|
|
|
<figure
|
|
|
|
class="image is-16by9"
|
|
|
|
:style="`background-image: url('${
|
|
|
|
event.picture ? event.picture.url : '/img/mobilizon_default_card.png'
|
|
|
|
}')`"
|
|
|
|
>
|
2019-05-22 14:12:11 +02:00
|
|
|
<div class="tag-container" v-if="event.tags">
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-tag v-for="tag in event.tags.slice(0, 3)" :key="tag.slug" type="is-light">{{
|
|
|
|
tag.title
|
|
|
|
}}</b-tag>
|
2019-04-24 20:49:52 +02:00
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</figure>
|
|
|
|
</div>
|
2020-02-18 08:47:41 +01:00
|
|
|
<div class="card-content">
|
|
|
|
<div class="media">
|
|
|
|
<div class="media-left">
|
2019-04-03 17:29:03 +02:00
|
|
|
<date-calendar-icon v-if="!mergedOptions.hideDate" :date="event.beginsOn" />
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
2020-02-18 08:47:41 +01:00
|
|
|
<div class="media-content">
|
|
|
|
<p class="event-title">{{ event.title }}</p>
|
|
|
|
<div class="event-subtitle" v-if="event.physicalAddress">
|
2020-02-18 08:57:00 +01:00
|
|
|
<!-- <p>{{ $t('By @{username}', { username: actor.preferredUsername }) }}</p>-->
|
2020-02-18 08:47:41 +01:00
|
|
|
<span>
|
2020-02-18 08:57:00 +01:00
|
|
|
{{ event.physicalAddress.description }}, {{ event.physicalAddress.locality }}
|
2020-02-18 08:47:41 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-01-21 15:08:22 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
<!-- <div class="date-and-title">-->
|
|
|
|
<!-- <div class="date-component">-->
|
|
|
|
<!-- <date-calendar-icon v-if="!mergedOptions.hideDate" :date="event.beginsOn" />-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <div class="title-wrapper">-->
|
|
|
|
<!-- <h4>{{ event.title }}</h4>-->
|
|
|
|
<!-- <div class="organizer-place-wrapper has-text-grey">-->
|
|
|
|
<!-- <span>{{ $t('By @{username}', { username: actor.preferredUsername }) }}</span>-->
|
|
|
|
<!-- ·-->
|
|
|
|
<!-- <span v-if="event.physicalAddress">-->
|
|
|
|
<!-- {{ event.physicalAddress.description }}, {{ event.physicalAddress.locality }}-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
<!-- <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}"-->
|
|
|
|
<!-- >{name} organizes this event</translate>-->
|
|
|
|
<!-- </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}"-->
|
|
|
|
<!-- > {name} is in,</translate>–>-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<!-- </div>-->
|
|
|
|
</router-link>
|
2019-01-21 15:08:22 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { IEvent, IEventCardOptions, ParticipantRole } from "@/types/event.model";
|
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
|
|
|
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
|
|
|
import { Actor, Person } from "@/types/actor";
|
2019-01-21 15:08:22 +01:00
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
@Component({
|
|
|
|
components: {
|
2019-04-03 17:29:03 +02:00
|
|
|
DateCalendarIcon,
|
2019-03-21 20:23:42 +01:00
|
|
|
},
|
|
|
|
})
|
2019-01-21 15:08:22 +01:00
|
|
|
export default class EventCard extends Vue {
|
|
|
|
@Prop({ required: true }) event!: IEvent;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-04-03 17:29:03 +02: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 16:37:40 +01:00
|
|
|
|
2020-02-18 08:47:41 +01:00
|
|
|
get actor(): Actor {
|
2020-02-18 08:57:00 +01:00
|
|
|
return Object.assign(
|
|
|
|
new Person(),
|
|
|
|
this.event.organizerActor || this.mergedOptions.organizerActor
|
|
|
|
);
|
2019-02-07 16:37:40 +01:00
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
}
|
|
|
|
</script>
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2019-11-15 18:36:47 +01:00
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
@import "../../variables";
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
a.card {
|
|
|
|
display: block;
|
|
|
|
background: $secondary;
|
2019-04-03 17:29:03 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
&:hover {
|
|
|
|
// box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
transform: scale(1.01, 1.01);
|
|
|
|
&:after {
|
|
|
|
opacity: 1;
|
2019-10-07 16:48:13 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2019-10-07 16:48:13 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
&:after {
|
|
|
|
content: "";
|
2019-10-07 16:48:13 +02:00
|
|
|
border-radius: 5px;
|
2020-02-18 08:57:00 +01:00
|
|
|
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;
|
2019-10-07 16:48:13 +02:00
|
|
|
transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-07 16:48:13 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -3px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
|
|
|
|
|
|
|
span.tag {
|
|
|
|
margin: 5px auto;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
font-size: 1em;
|
|
|
|
line-height: 1.75em;
|
2019-10-07 16:48:13 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-07 16:48:13 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
div.card-image {
|
|
|
|
background: $secondary;
|
2019-04-24 20:49:52 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
figure.image {
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
2019-04-24 20:49:52 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-04-24 20:49:52 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.card-content {
|
|
|
|
padding: 0.5rem;
|
|
|
|
|
|
|
|
.event-title {
|
|
|
|
font-size: 1.25rem;
|
|
|
|
line-height: 1.25rem;
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
|
|
|
min-height: 2.4rem;
|
2019-04-03 17:29:03 +02:00
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.event-subtitle {
|
|
|
|
font-size: 0.85rem;
|
|
|
|
display: inline-flex;
|
|
|
|
flex-wrap: wrap;
|
2019-10-10 13:48:03 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
span {
|
|
|
|
width: 15rem;
|
|
|
|
display: block;
|
|
|
|
overflow: hidden;
|
2019-10-02 17:59:07 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
flex-grow: 1;
|
2019-10-14 13:03:48 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
2019-04-03 17:29:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-04-03 17:29:03 +02:00
|
|
|
</style>
|