File size: 1,533 Bytes
dc649b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <script setup lang="ts">
import type { AuthPageLayoutType } from '@vben/types';
import type { VbenDropdownMenuItem } from '@vben-core/shadcn-ui';
import { computed } from 'vue';
import { InspectionPanel, PanelLeft, PanelRight } from '@vben/icons';
import { $t } from '@vben/locales';
import {
preferences,
updatePreferences,
usePreferences,
} from '@vben/preferences';
import { VbenDropdownRadioMenu, VbenIconButton } from '@vben-core/shadcn-ui';
defineOptions({
name: 'AuthenticationLayoutToggle',
});
const menus = computed((): VbenDropdownMenuItem[] => [
{
icon: PanelLeft,
label: $t('authentication.layout.alignLeft'),
value: 'panel-left',
},
{
icon: InspectionPanel,
label: $t('authentication.layout.center'),
value: 'panel-center',
},
{
icon: PanelRight,
label: $t('authentication.layout.alignRight'),
value: 'panel-right',
},
]);
const { authPanelCenter, authPanelLeft, authPanelRight } = usePreferences();
function handleUpdate(value: string) {
updatePreferences({
app: {
authPageLayout: value as AuthPageLayoutType,
},
});
}
</script>
<template>
<VbenDropdownRadioMenu
:menus="menus"
:model-value="preferences.app.authPageLayout"
@update:model-value="handleUpdate"
>
<VbenIconButton>
<PanelRight v-if="authPanelRight" class="size-4" />
<PanelLeft v-if="authPanelLeft" class="size-4" />
<InspectionPanel v-if="authPanelCenter" class="size-4" />
</VbenIconButton>
</VbenDropdownRadioMenu>
</template>
|