2024-05-19 13:20:42 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { VbenDropdownMenuItem } from '@vben-core/shadcn-ui';
|
2024-07-13 08:35:47 +00:00
|
|
|
import type { AuthPageLayoutType } from '@vben-core/typings';
|
2024-05-19 13:20:42 +00:00
|
|
|
|
2024-06-08 11:49:06 +00:00
|
|
|
import { computed } from 'vue';
|
|
|
|
|
2024-07-14 14:51:10 +00:00
|
|
|
import { MdiDockBottom, MdiDockLeft, MdiDockRight } from '@vben-core/icons';
|
2024-07-06 16:17:44 +00:00
|
|
|
import { $t } from '@vben-core/locales';
|
2024-06-09 04:53:38 +00:00
|
|
|
import {
|
|
|
|
preferences,
|
|
|
|
updatePreferences,
|
|
|
|
usePreferences,
|
|
|
|
} from '@vben-core/preferences';
|
2024-05-19 13:20:42 +00:00
|
|
|
import { VbenDropdownRadioMenu, VbenIconButton } from '@vben-core/shadcn-ui';
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
name: 'AuthenticationLayoutToggle',
|
|
|
|
});
|
|
|
|
|
|
|
|
const menus = computed((): VbenDropdownMenuItem[] => [
|
|
|
|
{
|
|
|
|
icon: MdiDockLeft,
|
|
|
|
key: 'panel-left',
|
2024-07-10 13:55:16 +00:00
|
|
|
text: $t('authentication.layout.alignLeft'),
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: MdiDockBottom,
|
|
|
|
key: 'panel-center',
|
2024-06-29 07:41:10 +00:00
|
|
|
text: $t('authentication.layout.center'),
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
icon: MdiDockRight,
|
|
|
|
key: 'panel-right',
|
2024-07-10 13:55:16 +00:00
|
|
|
text: $t('authentication.layout.alignRight'),
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
]);
|
|
|
|
|
2024-06-01 15:15:29 +00:00
|
|
|
const { authPanelCenter, authPanelLeft, authPanelRight } = usePreferences();
|
2024-06-09 04:53:38 +00:00
|
|
|
|
|
|
|
function handleUpdate(value: string) {
|
|
|
|
updatePreferences({
|
|
|
|
app: {
|
|
|
|
authPageLayout: value as AuthPageLayoutType,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2024-05-19 13:20:42 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<VbenDropdownRadioMenu
|
|
|
|
:menus="menus"
|
2024-06-09 04:53:38 +00:00
|
|
|
:model-value="preferences.app.authPageLayout"
|
|
|
|
@update:model-value="handleUpdate"
|
2024-05-19 13:20:42 +00:00
|
|
|
>
|
|
|
|
<VbenIconButton>
|
|
|
|
<MdiDockRight v-if="authPanelRight" class="size-5" />
|
|
|
|
<MdiDockLeft v-if="authPanelLeft" class="size-5" />
|
|
|
|
<MdiDockBottom v-if="authPanelCenter" class="size-5" />
|
|
|
|
</VbenIconButton>
|
|
|
|
</VbenDropdownRadioMenu>
|
|
|
|
</template>
|