2021-08-20 20:06:28 +00:00
|
|
|
<template>
|
|
|
|
<div class="source">
|
2021-08-27 12:43:14 +00:00
|
|
|
<div
|
|
|
|
:class="['source__container', { 'source__container__selected': selected } ]"
|
|
|
|
@click="clicked"
|
|
|
|
>
|
|
|
|
<div class="source__source">
|
|
|
|
{{ source.name }}
|
|
|
|
</div>
|
2021-08-20 20:06:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: ['source'],
|
2021-08-27 12:43:14 +00:00
|
|
|
computed: {
|
|
|
|
selected() {
|
|
|
|
return this.isSelected()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
isSelected() {
|
|
|
|
return this.$store.state.selection.selection[this.source.id]
|
|
|
|
},
|
|
|
|
clicked() {
|
|
|
|
if (this.isSelected()) {
|
|
|
|
this.$store.commit('selection/unselect', this.source.id)
|
|
|
|
} else {
|
|
|
|
this.$store.commit('selection/clearSelection')
|
|
|
|
this.$store.commit('selection/select', this.source.id)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2021-08-20 20:06:28 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.source {
|
|
|
|
position: absolute;
|
|
|
|
width: 180px;
|
|
|
|
height: 30px;
|
|
|
|
margin: -15px 0 0 -90px;
|
2021-08-27 12:43:14 +00:00
|
|
|
|
|
|
|
&__container {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
max-width: 180px;
|
|
|
|
height: 1.4em;
|
|
|
|
padding: 4px;
|
|
|
|
border: 1px solid #e0e0e0;
|
|
|
|
border-radius: 10px;
|
|
|
|
background-color: #402080;
|
|
|
|
color: #ffffff;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: #8060c0;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
&__selected,
|
|
|
|
&__selected:hover {
|
|
|
|
background-color: #ffffff;
|
|
|
|
color: #402080;
|
|
|
|
}
|
|
|
|
}
|
2021-08-20 20:06:28 +00:00
|
|
|
|
|
|
|
&__source {
|
|
|
|
width: 100%;
|
|
|
|
font-family: "Wendy One";
|
|
|
|
text-align: center;
|
2021-08-27 12:43:14 +00:00
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
user-select: none;
|
2021-08-20 20:06:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|