forked from potsda.mn/mobilizon
Improve the calendar datetime "icon" componenent
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
552467b523
commit
1a0a31255f
|
@ -12,9 +12,17 @@
|
||||||
</docs>
|
</docs>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<time class="datetime-container" :datetime="dateObj.getUTCSeconds()">
|
<time
|
||||||
<span class="month">{{ month }}</span>
|
class="datetime-container"
|
||||||
<span class="day">{{ day }}</span>
|
:class="{ small }"
|
||||||
|
:datetime="dateObj.getUTCSeconds()"
|
||||||
|
:style="`--small: ${smallStyle}`"
|
||||||
|
>
|
||||||
|
<div class="datetime-container-header" />
|
||||||
|
<div class="datetime-container-content">
|
||||||
|
<span class="day">{{ day }}</span>
|
||||||
|
<span class="month">{{ month }}</span>
|
||||||
|
</div>
|
||||||
</time>
|
</time>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -26,6 +34,7 @@ export default class DateCalendarIcon extends Vue {
|
||||||
* `date` can be a string or an actual date object.
|
* `date` can be a string or an actual date object.
|
||||||
*/
|
*/
|
||||||
@Prop({ required: true }) date!: string;
|
@Prop({ required: true }) date!: string;
|
||||||
|
@Prop({ required: false, default: false }) small!: boolean;
|
||||||
|
|
||||||
get dateObj(): Date {
|
get dateObj(): Date {
|
||||||
return new Date(this.$props.date);
|
return new Date(this.$props.date);
|
||||||
|
@ -38,28 +47,41 @@ export default class DateCalendarIcon extends Vue {
|
||||||
get day(): string {
|
get day(): string {
|
||||||
return this.dateObj.toLocaleString(undefined, { day: "numeric" });
|
return this.dateObj.toLocaleString(undefined, { day: "numeric" });
|
||||||
}
|
}
|
||||||
|
get smallStyle(): string {
|
||||||
|
return this.small ? "1.2" : "2";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
time.datetime-container {
|
time.datetime-container {
|
||||||
background: $backgrounds;
|
|
||||||
border: 1px solid $borders;
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
/*height: 50px;*/
|
|
||||||
width: 50px;
|
|
||||||
padding: 8px;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: hidden;
|
||||||
|
align-items: stretch;
|
||||||
|
width: calc(40px * var(--small));
|
||||||
|
box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
|
||||||
|
height: calc(40px * var(--small));
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.datetime-container-header {
|
||||||
|
height: calc(10px * var(--small));
|
||||||
|
background: #f3425f;
|
||||||
|
}
|
||||||
|
.datetime-container-content {
|
||||||
|
height: calc(30px * var(--small));
|
||||||
|
}
|
||||||
|
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: $violet-3;
|
||||||
|
|
||||||
&.month {
|
&.month {
|
||||||
color: $danger;
|
|
||||||
padding: 2px 0;
|
padding: 2px 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
|
@ -67,9 +89,8 @@ time.datetime-container {
|
||||||
}
|
}
|
||||||
|
|
||||||
&.day {
|
&.day {
|
||||||
color: $violet-3;
|
font-size: calc(1rem * var(--small));
|
||||||
font-size: 20px;
|
line-height: calc(1rem * var(--small));
|
||||||
line-height: 20px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,14 @@
|
||||||
{{ displayNameAndUsername(participation.actor) }}
|
{{ displayNameAndUsername(participation.actor) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="list-card">
|
<div class="list-card">
|
||||||
|
<div class="date-component">
|
||||||
|
<date-calendar-icon
|
||||||
|
:date="participation.event.beginsOn"
|
||||||
|
:small="true"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="title-wrapper">
|
<div class="title-wrapper">
|
||||||
<div class="date-component">
|
|
||||||
<date-calendar-icon :date="participation.event.beginsOn" />
|
|
||||||
</div>
|
|
||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: RouteName.EVENT,
|
name: RouteName.EVENT,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="content column">
|
<div class="content column">
|
||||||
<div class="title-wrapper">
|
<div class="title-wrapper">
|
||||||
<div class="date-component">
|
<div class="date-component">
|
||||||
<date-calendar-icon :date="event.beginsOn" />
|
<date-calendar-icon :date="event.beginsOn" :small="true" />
|
||||||
</div>
|
</div>
|
||||||
<router-link
|
<router-link
|
||||||
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
||||||
|
|
|
@ -3,7 +3,11 @@
|
||||||
class="event-minimalist-card-wrapper"
|
class="event-minimalist-card-wrapper"
|
||||||
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
:to="{ name: RouteName.EVENT, params: { uuid: event.uuid } }"
|
||||||
>
|
>
|
||||||
<date-calendar-icon class="calendar-icon" :date="event.beginsOn" />
|
<date-calendar-icon
|
||||||
|
class="calendar-icon"
|
||||||
|
:date="event.beginsOn"
|
||||||
|
:small="true"
|
||||||
|
/>
|
||||||
<div class="title-info-wrapper">
|
<div class="title-info-wrapper">
|
||||||
<p class="event-minimalist-title">{{ event.title }}</p>
|
<p class="event-minimalist-title">{{ event.title }}</p>
|
||||||
<p v-if="event.physicalAddress" class="has-text-grey">
|
<p v-if="event.physicalAddress" class="has-text-grey">
|
||||||
|
|
|
@ -1570,4 +1570,30 @@ a.participations-link {
|
||||||
border: 0;
|
border: 0;
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrapper,
|
||||||
|
.intro-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-wrapper {
|
||||||
|
position: relative;
|
||||||
|
padding: 0 16px 16px;
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
.date-calendar-icon-wrapper {
|
||||||
|
margin-top: 16px;
|
||||||
|
height: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
align-self: flex-start;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
margin-left: 0rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue