Created
April 16, 2019 17:00
-
-
Save iErik/c8b92864fac0282641493ffcce39cacb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="employee-info-timeline"> | |
| <div ref="shadowed" class="wrapper"> | |
| <info-timeline-item | |
| v-for="(item, index) in timelineItems" | |
| :key="index" | |
| :fields="item.fields" | |
| :item-info="item.itemInfo" | |
| v-on="$listeners" | |
| /> | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| import InfoTimelineItem from '@components/Employee/Details/Common/InfoTimelineItem' | |
| import { Shadowed } from 'convenia-components' | |
| export default { | |
| components: { InfoTimelineItem }, | |
| mixins: [ Shadowed() ], | |
| props: { | |
| items: { | |
| type: Array, | |
| required: true | |
| } | |
| }, | |
| computed: { | |
| timelineItems () { | |
| return this.items.map((item, index) => { | |
| const { subHighlight, highlight} = Object.keys(item || {}) | |
| .reduce((acc, fieldName) => { | |
| const cardProps = item[fieldName].infoCardProps || {} | |
| return { | |
| ...acc, | |
| ...(cardProps.highlight ? { highlight: { ...item[fieldName], fieldName } } : {}), | |
| ...(cardProps.subHighlight ? { subHighlight: { ...item[fieldName], fieldName } } : {}), | |
| } | |
| }, { }) | |
| return { | |
| itemInfo: { | |
| index, | |
| id: item.id.value, | |
| title: highlight || {}, | |
| subTitle: subHighlight || {}, | |
| icon: ((highlight || {}) || infoCardProps).icon | |
| }, | |
| fields: { | |
| ...item, | |
| [highlight.fieldName]: { hide: true }, | |
| [subHighlight.fieldName]: { hide: true }, | |
| } | |
| } | |
| }) | |
| } | |
| } | |
| } | |
| </script> | |
| <style lang="scss"> | |
| .employee-info-timeline { | |
| display: flex; | |
| flex-direction: column; | |
| margin-top: 20px; | |
| max-height: 625px; | |
| overflow-y: hidden; | |
| @include shadowed(150px); | |
| & > .wrapper { | |
| overflow-y: auto; | |
| flex: 1; | |
| } | |
| } | |
| </style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment