ruoyi-plus-vben5/packages/effects/layouts/src/authentication/toolbar.vue

48 lines
1.2 KiB
Vue
Raw Normal View History

2024-05-19 21:20:42 +08:00
<script setup lang="ts">
import type { ToolbarType } from './types';
import { computed } from 'vue';
2024-05-19 21:20:42 +08:00
import {
AuthenticationColorToggle,
AuthenticationLayoutToggle,
LanguageToggle,
ThemeToggle,
} from '../widgets';
2024-05-19 21:20:42 +08:00
interface Props {
toolbarList?: ToolbarType[];
}
2024-05-19 21:20:42 +08:00
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'));
2024-05-19 21:20:42 +08:00
</script>
2024-05-19 21:20:42 +08:00
<template>
<div
:class="{
'bg-accent rounded-3xl px-3 py-1': toolbarList.length > 1,
}"
class="flex-center absolute right-2 top-4 z-10"
2024-05-19 21:20:42 +08:00
>
<!-- Only show on medium and larger screens -->
2024-05-19 21:20:42 +08:00
<div class="hidden md:flex">
<AuthenticationColorToggle v-if="showColor" />
<AuthenticationLayoutToggle v-if="showLayout" />
2024-05-19 21:20:42 +08:00
</div>
<!-- Always show Language and Theme toggles -->
<LanguageToggle v-if="showLanguage" />
<ThemeToggle v-if="showTheme" />
2024-05-19 21:20:42 +08:00
</div>
</template>