chore: Replace darkmode mixin with useDarkMode composable [CW-3474] (#9949)

# Pull Request Template

## Description

Replaces darkModeMixin with the new useDarkMode composable and replaces
wll usages of mixin the the composable in components and pages

Fixes
https://linear.app/chatwoot/issue/CW-3474/rewrite-darkmodemixin-mixin-to-a-composable

## Type of change

Please delete options that are not relevant.

- [x] New feature (non-breaking change which adds functionality)

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
This commit is contained in:
Fayaz Ahmed
2024-09-12 00:29:41 +05:30
committed by GitHub
parent 2c17c95eab
commit a76cd7684a
27 changed files with 357 additions and 207 deletions

View File

@@ -1,13 +1,12 @@
<script>
import HeaderActions from './HeaderActions.vue';
import darkModeMixin from 'widget/mixins/darkModeMixin.js';
import { useDarkMode } from 'widget/composables/useDarkMode';
export default {
name: 'ChatHeaderExpanded',
components: {
HeaderActions,
},
mixins: [darkModeMixin],
props: {
avatarUrl: {
type: String,
@@ -26,6 +25,10 @@ export default {
default: false,
},
},
setup() {
const { getThemeClass } = useDarkMode();
return { getThemeClass };
},
};
</script>
@@ -51,12 +54,12 @@ export default {
<h2
v-dompurify-html="introHeading"
class="mt-4 text-2xl mb-1.5 font-medium"
:class="$dm('text-slate-900', 'dark:text-slate-50')"
:class="getThemeClass('text-slate-900', 'dark:text-slate-50')"
/>
<p
v-dompurify-html="introBody"
class="text-base leading-normal"
:class="$dm('text-slate-700', 'dark:text-slate-200')"
:class="getThemeClass('text-slate-700', 'dark:text-slate-200')"
/>
</header>
</template>