1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-24 16:36:46 +00:00
bramw_baserow/web-frontend/modules/database/components/Rating.vue
Jonathan Adeline 4321aaea9a Replace icons
2023-09-28 13:39:41 +00:00

54 lines
1013 B
Vue

<template functional>
<div
class="rating"
:class="[
data.staticClass,
`color--${props.color}`,
props.readOnly ? '' : 'editing',
]"
>
<i
v-for="index in props.readOnly ? props.value : props.maxValue"
:key="index"
class="rating__star"
:class="{
[`baserow-icon-${props.ratingStyle}`]: true,
'rating__star--selected': index <= props.value,
}"
@click="
!props.readOnly &&
listeners['update'] &&
listeners['update'](index === props.value ? 0 : index)
"
/>
</div>
</template>
<script>
export default {
name: 'Rating',
props: {
readOnly: {
default: false,
type: Boolean,
},
value: {
required: true,
validator: () => true,
},
maxValue: {
required: true,
type: Number,
},
ratingStyle: {
default: 'star',
type: String,
},
color: {
default: 'dark-orange',
type: String,
},
},
}
</script>