Chatwoot/app/javascript/shared/components/ChatOptions.vue
Sivin Varghese caee9535f1
feat: Support Dark mode for the widget (#4137)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2022-04-01 20:59:03 +05:30

100 lines
1.9 KiB
Vue

<template>
<div
class="options-message chat-bubble agent"
:class="$dm('bg-white', 'dark:bg-slate-700')"
>
<div class="card-body">
<h4 class="title" :class="$dm('text-black-900', 'dark:text-slate-50')">
{{ title }}
</h4>
<ul
v-if="!hideFields"
class="options"
:class="{ 'has-selected': !!selected }"
>
<chat-option
v-for="option in options"
:key="option.id"
:action="option"
:is-selected="isSelected(option)"
@click="onClick"
/>
</ul>
</div>
</div>
</template>
<script>
import ChatOption from 'shared/components/ChatOption';
import darkModeMixin from 'widget/mixins/darkModeMixin.js';
export default {
components: {
ChatOption,
},
mixins: [darkModeMixin],
props: {
title: {
type: String,
default: '',
},
options: {
type: Array,
default: () => [],
},
selected: {
type: String,
default: '',
},
hideFields: {
type: Boolean,
default: false,
},
},
methods: {
isSelected(option) {
return this.selected === option.id;
},
onClick(selectedOption) {
this.$emit('click', selectedOption);
},
},
};
</script>
<style lang="scss">
@import '~dashboard/assets/scss/variables.scss';
.has-selected {
.option-button:not(.is-selected) {
color: $color-light-gray;
cursor: initial;
}
}
</style>
<style scoped lang="scss">
@import '~widget/assets/scss/variables.scss';
.options-message {
max-width: 17rem;
padding: $space-small $space-normal;
border-radius: $space-small;
overflow: hidden;
.title {
font-size: $font-size-default;
font-weight: $font-weight-normal;
margin-top: $space-smaller;
margin-bottom: $space-smaller;
line-height: 1.5;
}
.options {
width: 100%;
> li {
list-style: none;
padding: 0;
}
}
}
</style>