Files
ruoyi-plus-vben5/packages/effects/layouts/src/authentication/toolbar.vue
Vben 6c4a742627 refactor: remove the adapter bucket introduction pattern and improve potential introduction timing (#4635)
* refactor: remove the adapter bucket introduction pattern and improve potential introduction timing

* chore: update deps
2024-10-14 22:53:23 +08:00

50 lines
1.4 KiB
Vue

<script setup lang="ts">
import type { ToolbarType } from './types';
import { computed } from 'vue';
import { preferences } from '@vben/preferences';
import {
AuthenticationColorToggle,
AuthenticationLayoutToggle,
LanguageToggle,
ThemeToggle,
} from '../widgets';
interface Props {
toolbarList?: ToolbarType[];
}
defineOptions({
name: 'AuthenticationToolbar',
});
const props = withDefaults(defineProps<Props>(), {
toolbarList: () => ['color', 'language', 'layout', 'theme'],
});
const showColor = computed(() => props.toolbarList.includes('color'));
const showLayout = computed(() => props.toolbarList.includes('layout'));
const showLanguage = computed(() => props.toolbarList.includes('language'));
const showTheme = computed(() => props.toolbarList.includes('theme'));
</script>
<template>
<div
:class="{
'bg-accent rounded-3xl px-3 py-1': toolbarList.length > 1,
}"
class="flex-center absolute right-2 top-4 z-10"
>
<!-- Only show on medium and larger screens -->
<div class="hidden md:flex">
<AuthenticationColorToggle v-if="showColor" />
<AuthenticationLayoutToggle v-if="showLayout" />
</div>
<!-- Always show Language and Theme toggles -->
<LanguageToggle v-if="showLanguage && preferences.widget.languageToggle" />
<ThemeToggle v-if="showTheme && preferences.widget.themeToggle" />
</div>
</template>