Files
chatwoot/app/javascript/shared/components/Button.vue
Sivin Varghese 3a693947b5 feat: Add RTL Support to Widget (#11022)
This PR adds RTL support to the web widget for improved right-to-left language compatibility, updates colors, and cleans up code.

Fixes https://linear.app/chatwoot/issue/CW-4089/rtl-issues-on-widget

https://github.com/chatwoot/chatwoot/issues/9791

Other PR: https://github.com/chatwoot/chatwoot/pull/11016
2025-03-21 09:39:03 -07:00

60 lines
1.2 KiB
Vue

<script>
export default {
props: {
block: {
type: Boolean,
default: false,
},
type: {
type: String,
default: 'blue',
},
bgColor: {
type: String,
default: '',
},
textColor: {
type: String,
default: '',
},
disabled: {
type: Boolean,
default: false,
},
},
computed: {
buttonClassName() {
let className =
'text-white py-3 px-4 rounded-lg shadow-sm leading-4 cursor-pointer disabled:opacity-50';
if (this.type === 'clear') {
className = 'flex mx-auto mt-4 text-xs leading-3 w-auto text-black-600';
}
if (this.type === 'blue' && !Object.keys(this.buttonStyles).length) {
className = `${className} bg-woot-500 hover:bg-woot-700`;
}
if (this.block) {
className = `${className} w-full`;
}
return className;
},
buttonStyles() {
const styles = {};
if (this.bgColor) {
styles.backgroundColor = this.bgColor;
}
if (this.textColor) {
styles.color = this.textColor;
}
return styles;
},
},
};
</script>
<template>
<button :class="buttonClassName" :style="buttonStyles" :disabled="disabled">
<slot />
</button>
</template>