Skip to content

Commit 1d786cc

Browse files
committed
chore: add styles for the login view
1 parent 93760f9 commit 1d786cc

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

adminforth/modules/styles.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ export const styles = () => ({
278278
lightListViewButtonFocusRing: "#F3F4F6",
279279
lightListViewButtonBorder: "#D1D5DB",
280280

281+
282+
/* Login View */
283+
lightLoginViewBackground: "#FFFFFF",
284+
lightLoginViewTextColor: "#111827",
285+
lightLoginViewSubTextColor: "#9CA3AF",
286+
lightLoginViewPromptBackground: "#F9FAFB",
287+
lightLoginViewPromptText: "#1F2937",
288+
289+
281290

282291

283292
// colors for dark theme
@@ -547,6 +556,13 @@ export const styles = () => ({
547556
darkListViewButtonFocusRing: "#374151",
548557
darkListViewButtonBorder: "#4B5563",
549558

559+
/* Login view */
560+
darkLoginViewBackground: "#374151",
561+
darkLoginViewTextColor: "#FFFFFF",
562+
darkLoginViewSubTextColor: "#D1D5DB",
563+
darkLoginViewPromptBackground: "#1F2937",
564+
darkLoginViewPromptText: "#9CA3AF",
565+
550566

551567
},
552568
boxShadow: {

adminforth/spa/src/views/LoginView.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800 relative w-screen h-screen"
2+
<div class="relative flex items-center justify-center min-h-screen bg-lightHtml dark:bg-darkHtml w-screen h-screen"
33
:style="coreStore.config?.loginBackgroundImage && backgroundPosition === 'over' ? {
44
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
55
'background-size': 'cover',
@@ -27,7 +27,7 @@
2727
overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
2828
<div class="relative p-4 w-full max-h-full max-w-[400px]">
2929
<!-- Modal content -->
30-
<div class="af-login-modal-content relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black" >
30+
<div class="af-login-modal-content relative bg-lightLoginViewBackground rounded-lg shadow dark:bg-darkLoginViewBackground dark:shadow-black" >
3131
<!-- Modal header -->
3232
<div class="af-login-modal-header flex items-center justify-between flex-col p-4 md:p-5 border-b rounded-t dark:border-gray-600">
3333

@@ -39,15 +39,15 @@
3939
:meta="c.meta"
4040
/>
4141
</template>
42-
<h3 v-else class="text-xl font-semibold text-gray-900 dark:text-white">
42+
<h3 v-else class="text-xl font-semibold text-lightLoginViewText dark:text-darkLoginViewTextColor">
4343
{{ $t('Sign in to') }} {{ coreStore.config?.brandName }}
4444
</h3>
4545
</div>
4646
<!-- Modal body -->
4747
<div class="af-login-modal-body p-4 md:p-5">
4848
<form class="space-y-4" @submit.prevent>
4949
<div>
50-
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ $t('Your') }} {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
50+
<label for="username" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your') }} {{ coreStore.config?.usernameFieldName?.toLowerCase() }}</label>
5151
<Input
5252
v-model="username"
5353
autocomplete="username"
@@ -61,7 +61,7 @@
6161
placeholder="[email protected]" required />
6262
</div>
6363
<div class="">
64-
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{ $t('Your password') }}</label>
64+
<label for="password" class="block mb-2 text-sm font-medium text-lightLoginViewText dark:text-darkLoginViewTextColor">{{ $t('Your password') }}</label>
6565
<Input
6666
v-model="password"
6767
ref="passwordInput"
@@ -70,7 +70,7 @@
7070
@keydown.enter="login"
7171
:type="!showPw ? 'password': 'text'" name="password" id="password" placeholder="••••••••" class="w-full" required>
7272
<template #rightIcon>
73-
<button type="button" @click="showPw = !showPw" class="text-gray-400 dark:text-gray-300">
73+
<button type="button" @click="showPw = !showPw" class="text-lightLoginViewSubTextColor dark:text-darkLoginViewSubTextColor">
7474
<IconEyeSolid class="w-5 h-5" v-if="!showPw" />
7575
<IconEyeSlashSolid class="w-5 h-5" v-else />
7676
</button>
@@ -105,7 +105,7 @@
105105
</div>
106106

107107
<div v-if="coreStore.config?.loginPromptHTML"
108-
class="flex items-center p-4 mb-4 text-sm text-gray-800 rounded-lg bg-gray-50 dark:bg-gray-800 dark:text-gray-400" role="alert"
108+
class="flex items-center p-4 mb-4 text-sm text-lightLoginViewPromptText rounded-lg bg-lightLoginViewPromptBackground dark:bg-darkLoginViewPromptBackground dark:text-darkLoginViewPromptText" role="alert"
109109
>
110110
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
111111
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>

dev-demo/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,13 @@ export const admin = new AdminForth({
397397
ListViewButtonFocusRing: "alias:lightlistViewButtonBackground",
398398
ListViewButtonBorder: "alias:lightListViewButtonBackground darken",
399399

400+
LoginViewBackground: "alias:lightPrimary lighten",
401+
LoginViewTextColor: "alias:lightLoginViewBackground inverse",
402+
LoginViewSubTextColor: "alias:lightLoginViewTextColor opacity:0.8",
403+
LoginViewPromptBackground: "alias:lightLoginViewTextColor opacity:0.1",
404+
LoginViewPromptText: "alias:ligthLoginViewTextColor",
405+
406+
400407

401408
},
402409
dark: {
@@ -625,6 +632,12 @@ export const admin = new AdminForth({
625632
ListViewButtonFocusRing: "alias:darklistViewButtonBackground",
626633
ListViewButtonBorder: "alias:darkListViewButtonBackground darken",
627634

635+
LoginViewBackground: "alias:darkPrimary lighten",
636+
LoginViewTextColor: "alias:darkLoginViewBackground inverse",
637+
LoginViewSubTextColor: "alias:darkLoginViewTextColor opacity:0.8",
638+
LoginViewPromptBackground: "alias:darkLoginViewTextColor opacity:0.1",
639+
LoginViewPromptText: "alias:darkLoginViewTextColor",
640+
628641
}
629642
}
630643
},

0 commit comments

Comments
 (0)