2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/ui/components/Indicator.vue
Faris Ansari 5375f21d30 Indicators
- Replace hardcoded color values with constants
- Add remaining color styles in Indicator component
- Show Indicator in List View
2018-07-09 20:25:24 +05:30

61 lines
1.2 KiB
Vue

<template>
<span :class="['indicator', 'indicator-' + color]"></span>
</template>
<script>
import indicatorColor from 'frappejs/ui/constants/indicators';
export default {
props: {
color: {
type: String,
required: true,
default: indicatorColor.GREY,
validator(value) {
const validColors = Object.values(indicatorColor);
const valid = validColors.includes(value);
if (!valid) {
console.warn(`color must be one of `, validColors);
}
return valid;
}
}
}
}
</script>
<style lang="scss">
@import "../styles/variables";
.indicator {
display: inline-block;
width: 0.5rem;
height: 0.5rem;
border-radius: 50%;
}
.indicator-grey {
background-color: $gray-300;
}
.indicator-blue {
background-color: $blue;
}
.indicator-red {
background-color: $red;
}
.indicator-green {
background-color: $green;
}
.indicator-orange {
background-color: $orange;
}
.indicator-purple {
background-color: $purple;
}
.indicator-yellow {
background-color: $yellow;
}
.indicator-black {
background-color: $gray-800;
}
</style>