yandere_fe/src/components/selectable_list/selectable_list.vue

44 lines
1.1 KiB
Vue
Raw Normal View History

2019-04-03 18:43:24 -07:00
<template>
<div class="selectable-list">
<div v-for="item in items" :key="getKey(item)" class="selectable-list-item" :class="{ 'selectable-list-item-selected': isSelected(item) }">
<div class="selectable-list-checkbox-wrapper">
<Checkbox :checked="isSelected(item)" @change="checked => toggle(checked, item)" />
</div>
<slot name="item" :item="item" />
</div>
<div class="selectable-list-empty-content faint" v-if="items.length === 0">
<slot name="empty" />
</div>
2019-04-03 18:43:24 -07:00
</div>
</template>
<script src="./selectable_list.js"></script>
2019-04-03 18:43:24 -07:00
<style lang="scss">
@import '../../_variables.scss';
.selectable-list {
&-item {
display: flex;
2019-04-03 20:42:24 -07:00
border-bottom: 1px solid;
border-bottom-color: $fallback--border;
border-bottom-color: var(--border, $fallback--border);
&-selected {
background-color: $fallback--lightBg;
background-color: var(--lightBg, $fallback--lightBg);
}
}
&-checkbox-wrapper {
padding: 10px;
flex: none;
}
&-empty-content {
text-align: center;
padding: 10px;
}
}
2019-04-03 18:43:24 -07:00
</style>