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