c3lf-system-3/web/src/components/Timeline.vue

172 lines
3.7 KiB
Vue
Raw Normal View History

2023-11-23 22:17:20 +00:00
<template>
<ol class="timeline">
2023-12-06 05:47:30 +00:00
<li v-for="(item, index) in timeline" :key="index"
:class="{'timeline-item':true, 'extra-space': item.type === 'mail'}">
<span class="timeline-item-icon filled-icon" v-if="item.type === 'mail'">
<font-awesome-icon icon="envelope"/>
2023-11-23 22:17:20 +00:00
</span>
2023-12-06 05:47:30 +00:00
<span class="timeline-item-icon faded-icon" v-else-if="item.type === 'comment'">
<font-awesome-icon icon="comment"/>
</span>
<span class="timeline-item-icon faded-icon" v-else-if="item.type === 'state'">
2023-11-23 22:17:20 +00:00
<font-awesome-icon icon="check"/>
</span>
2023-12-06 05:47:30 +00:00
<span class="timeline-item-icon faded-icon" v-else>
<font-awesome-icon icon="pen"/>
2023-11-23 22:17:20 +00:00
</span>
2023-12-06 05:47:30 +00:00
<TimelineMail v-if="item.type === 'mail'" :item="item"/>
<TimelineComment v-else-if="item.type === 'comment'" :item="item"/>
<TimelineStateChange v-else-if="item.type === 'state'" :item="item"/>
<p v-else>{{ item }}</p>
2023-11-23 22:17:20 +00:00
</li>
<li class="timeline-item">
<span class="timeline-item-icon | faded-icon">
<font-awesome-icon icon="comment"/>
</span>
<div class="new-comment">
<input type="text" placeholder="Add a comment..."/>
</div>
</li>
</ol>
</template>
<script>
2023-12-06 05:47:30 +00:00
import TimelineMail from "@/components/TimelineMail.vue";
import TimelineComment from "@/components/TimelineComment.vue";
import TimelineStateChange from "@/components/TimelineStateChange.vue";
2023-11-23 22:17:20 +00:00
export default {
name: 'Timeline',
2023-12-06 05:47:30 +00:00
components: {TimelineStateChange, TimelineComment, TimelineMail},
2023-11-23 22:17:20 +00:00
props: {
timeline: {
type: Array,
default: () => []
}
},
};
</script>
2023-12-06 05:47:30 +00:00
<style lang="scss" scoped>
2023-11-23 22:17:20 +00:00
*,
*:before,
*:after {
box-sizing: border-box;
}
button,
input,
select,
textarea {
font: inherit;
}
a {
color: inherit;
}
img {
display: block;
max-width: 100%;
}
/* End basic CSS override */
.timeline {
width: 85%;
display: flex;
flex-direction: column;
padding: 32px 0 32px 32px;
2023-12-06 05:47:30 +00:00
border-left: 2px solid var(--gray);
2023-11-23 22:17:20 +00:00
font-size: 1.125rem;
margin: 0 auto;
}
.timeline-item {
display: flex;
gap: 24px;
& + * {
margin-top: 24px;
}
& + .extra-space {
margin-top: 48px;
}
}
.new-comment {
width: 100%;
input {
2023-12-06 05:47:30 +00:00
border: 1px solid var(--gray);
2023-11-23 22:17:20 +00:00
border-radius: 6px;
height: 48px;
padding: 0 16px;
width: 100%;
&::placeholder {
2023-12-06 05:47:30 +00:00
color: var(--gray-dark);
2023-11-23 22:17:20 +00:00
}
&:focus {
2023-12-06 05:47:30 +00:00
border-color: var(--gray-dark);
2023-11-23 22:17:20 +00:00
outline: 0; /* Don't actually do this */
2023-12-06 05:47:30 +00:00
box-shadow: 0 0 0 4px var(--dark);
2023-11-23 22:17:20 +00:00
}
}
}
.timeline-item-icon {
display: flex;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
border-radius: 50%;
margin-left: -57px;
flex-shrink: 0;
overflow: hidden;
svg {
width: 20px;
height: 20px;
}
&.faded-icon {
2023-12-06 05:47:30 +00:00
background-color: var(--secondary);
color: var(--light);
2023-11-23 22:17:20 +00:00
}
&.filled-icon {
2023-12-06 05:47:30 +00:00
background-color: var(--primary);
color: var(--light);
2023-11-23 22:17:20 +00:00
}
}
.button {
border: 0;
display: inline-flex;
vertical-align: middle;
margin-right: 4px;
margin-top: 12px;
align-items: center;
justify-content: center;
font-size: 1rem;
height: 32px;
padding: 0 8px;
2023-12-06 05:47:30 +00:00
background-color: var(--dark);
2023-11-23 22:17:20 +00:00
flex-shrink: 0;
cursor: pointer;
border-radius: 99em;
&:hover {
2023-12-06 05:47:30 +00:00
background-color: var(--gray);
2023-11-23 22:17:20 +00:00
}
}
</style>