2024-05-19 13:20:42 +00:00
|
|
|
<script setup lang="ts">
|
2024-07-22 16:03:59 +00:00
|
|
|
import type { AuthPageLayoutType } from '@vben/types';
|
2024-05-19 13:20:42 +00:00
|
|
|
import type { VbenDropdownMenuItem } from '@vben-core/shadcn-ui';
|
|
|
|
|
2024-06-08 11:49:06 +00:00
|
|
|
import { computed } from 'vue';
|
|
|
|
|
2024-07-22 16:03:59 +00:00
|
|
|
import { InspectionPanel, PanelLeft, PanelRight } from '@vben/icons';
|
|
|
|
import { $t } from '@vben/locales';
|
2024-06-09 04:53:38 +00:00
|
|
|
import {
|
|
|
|
preferences,
|
|
|
|
updatePreferences,
|
|
|
|
usePreferences,
|
2024-07-22 16:03:59 +00:00
|
|
|
} from '@vben/preferences';
|
2024-05-19 13:20:42 +00:00
|
|
|
import { VbenDropdownRadioMenu, VbenIconButton } from '@vben-core/shadcn-ui';
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
name: 'AuthenticationLayoutToggle',
|
|
|
|
});
|
|
|
|
|
|
|
|
const menus = computed((): VbenDropdownMenuItem[] => [
|
|
|
|
{
|
2024-07-17 14:25:27 +00:00
|
|
|
icon: PanelLeft,
|
2024-05-19 13:20:42 +00:00
|
|
|
key: 'panel-left',
|
2024-07-10 13:55:16 +00:00
|
|
|
text: $t('authentication.layout.alignLeft'),
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
{
|
2024-07-17 14:25:27 +00:00
|
|
|
icon: InspectionPanel,
|
2024-05-19 13:20:42 +00:00
|
|
|
key: 'panel-center',
|
2024-06-29 07:41:10 +00:00
|
|
|
text: $t('authentication.layout.center'),
|
2024-05-19 13:20:42 +00:00
|
|
|
},
|
|
|
|
{
|
2024-07-17 14:25:27 +00:00
|
|
|
icon: PanelRight,
|
2024-05-19 13:20:42 +00:00
|
|
|
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>
|
2024-07-17 14:25:27 +00:00
|
|
|
<PanelRight v-if="authPanelRight" class="size-4" />
|
|
|
|
<PanelLeft v-if="authPanelLeft" class="size-4" />
|
|
|
|
<InspectionPanel v-if="authPanelCenter" class="size-4" />
|
2024-05-19 13:20:42 +00:00
|
|
|
</VbenIconButton>
|
|
|
|
</VbenDropdownRadioMenu>
|
|
|
|
</template>
|