Add notes rendering and styles

This commit is contained in:
Angelina Filippova 2019-03-31 02:33:02 +07:00
parent b266dc31eb
commit f885cdbaf1
3 changed files with 65 additions and 8 deletions

View file

@ -3,30 +3,39 @@ const reports = {
fetchedReports: [
{
id: '1',
timestamp: '2018/4/12',
timestamp: '2019/4/12',
local: true,
from: 'John', // actor nickname
object: 'Bob', // user nickname
header: 'Report #1', // content
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
notes: [
{ author: 'Nick', text: 'Lorem ipsum', timestamp: '2019/4/13' },
{ author: 'Val', text: 'dolor sit amet', timestamp: '2019/4/13' }
]
},
{
id: '2',
timestamp: '2018/4/1',
timestamp: '2019/4/1',
local: true,
from: 'Max',
object: 'Vic',
header: 'Report #2',
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
notes: [
{ author: 'Tony', text: 'consectetur adipiscing elit', timestamp: '2019/4/2' },
{ author: 'Zac', text: 'sed do eiusmod tempor incididunt', timestamp: '2019/4/3' }
]
},
{
id: '3',
timestamp: '2018/2/28',
timestamp: '2019/2/28',
local: true,
from: 'Tim',
object: 'Jen',
header: 'Report #3',
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
notes: [{ author: 'Bruce', text: 'ut labore et dolore magna aliqua', timestamp: '2019/3/1' }]
}
]
},

View file

@ -1,8 +1,19 @@
<template>
<el-timeline-item :timestamp="item.timestamp" placement="top">
<el-timeline-item :timestamp="item.timestamp" placement="top" class="timeline-item-container">
<el-card>
<h4>{{ item.header }}</h4>
<p>{{ item.content }}</p>
<el-collapse v-model="showNotes">
<el-collapse-item title="Show notes" name="showNotes">
<div v-for="note in item.notes" :key="note.id">
<el-card class="note">
<h4>From {{ note.author }}</h4>
<p class="timestamp">{{ note.timestamp }}</p>
<p class="note-text">{{ note.text }}</p>
</el-card>
</div>
</el-collapse-item>
</el-collapse>
</el-card>
</el-timeline-item>
</template>
@ -15,6 +26,43 @@ export default {
type: Object,
required: true
}
},
data() {
return {
showNotes: []
}
}
}
</script>
<style rel='stylesheet/scss' lang='scss'>
.el-card__body {
padding: 17px 17px 0;
}
.el-collapse-item__header {
border-bottom: none;
height: 46px;
}
.el-collapse-item__content {
padding-bottom: 7px;
}
h4 {
margin: 0;
height: 17px;
}
.note {
box-shadow: 0 2px 5px 0 rgba(0,0,0,.1);
margin-bottom: 10px;
}
.note-text {
margin-bottom: 14px;
}
.timestamp {
margin: 0;
font-style: italic;
color: gray;
}
@media
only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {}
</style>

View file

@ -28,7 +28,7 @@ export default {
margin: 22px 0 0 15px;
}
.el-timeline {
margin: 45px;
margin: 45px 45px 45px 19px;
padding: 0px;
}
}