Skip to content

Commit

Permalink
add hover-changed callback to return anatomy
Browse files Browse the repository at this point in the history
  • Loading branch information
ddjnw1yu committed May 13, 2024
1 parent fb1d433 commit d8e94bf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
:activeId="activeId"
@tabClicked="tabClicked"
@search-changed="searchChanged($event)"
@hover-changed="hoverChanged($event)"
@actionClick="action"
/>
</div>
Expand Down Expand Up @@ -110,6 +111,9 @@ export default {
}
},
methods: {
hoverChanged: function (data) {
console.log('hoverChanged', data)
},
searchChanged: function (data) {
console.log(data)
},
Expand Down
2 changes: 2 additions & 0 deletions src/algolia/algolia.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class AlgoliaClient {
for (let res of results) {
newResult = { ...res }
newResult = {
anatomy: res.anatomy ? res.anatomy.organ.map((organ => organ.curie)) : undefined,
doi: res.item.curie.split(':')[1],
name: res.item.name,
description: res.item.description,
Expand Down Expand Up @@ -167,6 +168,7 @@ export class AlgoliaClient {
'item.name',
'item.description',
'objectID',
'anatomy.organ.curie'
],
})
.then(response => {
Expand Down
12 changes: 8 additions & 4 deletions src/components/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
:envVars="envVars"
:ref="tab.id"
@search-changed="searchChanged(tab.id, $event)"
@hover-changed="hoverChanged($event)"
/>
</template>
</div>
Expand Down Expand Up @@ -113,11 +114,14 @@ export default {
}
},
methods: {
hoverChanged: function (data) {
this.$emit('hover-changed', data)
},
/**
* This event is emitted when the search filters are changed.
* @arg `obj` {data, id}
*/
searchChanged: function (id, data) {
/**
* This event is emitted when the search filters are changed.
* @arg `obj` {data, id}
*/
this.$emit('search-changed', { ...data, id: id })
},
/**
Expand Down
19 changes: 17 additions & 2 deletions src/components/SidebarContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@
No results found - Please change your search / filter criteria.
</div>
<div v-for="result in results" :key="result.doi" class="step-item">
<DatasetCard :entry="result" :envVars="envVars"></DatasetCard>
<DatasetCard
class="dataset-card"
:entry="result"
:envVars="envVars"
@mouseenter="hoverChanged(result)"
@mouseleave="hoverChanged(undefined)"
/>
</div>
<el-pagination
class="pagination"
Expand Down Expand Up @@ -154,6 +160,9 @@ export default {
},
},
methods: {
hoverChanged: function (data) {
this.$emit('hover-changed', data)
},
resetSearch: function () {
this.numberOfHits = 0
this.discoverIds = []
Expand Down Expand Up @@ -449,6 +458,12 @@ export default {
</script>

<style lang="scss" scoped>
.dataset-card:hover {
border-style: solid;
border-color: var(--el-color-primary);
border-radius: 5px;
}
.content-card {
height: 100%;
flex-flow: column;
Expand Down Expand Up @@ -527,7 +542,7 @@ export default {
}
.content :deep(.step-item:not(:first-child) .seperator-path) {
width: 486px;
width: 455px;
height: 0px;
border: solid 1px #e4e7ed;
background-color: #e4e7ed;
Expand Down

0 comments on commit d8e94bf

Please sign in to comment.