init: чистый старт Laravel + Vuexy
This commit is contained in:
28
resources/ts/@core/composable/useGenerateImageVariant.ts
Normal file
28
resources/ts/@core/composable/useGenerateImageVariant.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { useTheme } from 'vuetify'
|
||||
import { useConfigStore } from '@core/stores/config'
|
||||
|
||||
// composable function to return the image variant as per the current theme and skin
|
||||
export const useGenerateImageVariant = (imgLight: string, imgDark: string, imgLightBordered?: string, imgDarkBordered?: string, bordered = false) => {
|
||||
const configStore = useConfigStore()
|
||||
const { global } = useTheme()
|
||||
|
||||
return computed(() => {
|
||||
if (global.name.value === 'light') {
|
||||
if (configStore.skin === 'bordered' && bordered)
|
||||
return imgLightBordered
|
||||
|
||||
else
|
||||
return imgLight
|
||||
}
|
||||
if (global.name.value === 'dark') {
|
||||
if (configStore.skin === 'bordered' && bordered)
|
||||
return imgDarkBordered
|
||||
|
||||
else
|
||||
return imgDark
|
||||
}
|
||||
|
||||
// Add a default return statement
|
||||
return imgLight
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user