Skip to content

Commit a240d1b

Browse files
committed
chore: add styles for create view
1 parent 7118495 commit a240d1b

File tree

3 files changed

+48
-4
lines changed

3 files changed

+48
-4
lines changed

adminforth/modules/styles.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,21 @@ export const styles = () => ({
245245
lightToastCloseIconBackgroundHover: "#F3F4F6",
246246
lightToastCloseIconFocusRing: "#D1D5DB",
247247
lightToastText: "#6B7280",
248+
249+
lightCreateViewCancelButtonBackground: "#FFFFFF",
250+
lightCreateViewCancelButtonBackgroundHover: "#F3F4F6",
251+
lightCreateViewCancelButtonText: "#111827",
252+
lightCreateViewCancelButtonTextHover: "alias:lightPrimary",
253+
lightCreateViewCancelButtonFocusRing: "#F3F4F6",
254+
lightCreateViewCancelButtonBorder: "#D1D5DB",
255+
256+
lightCreateViewSaveButtonBackground: "#FFFFFF",
257+
lightCreateViewSaveButtonBackgroundHover: "#F3F4F6",
258+
lightCreateViewSaveButtonText: "#DC2626",
259+
lightCreateViewSaveButtonTextHover: "#B91C1C",
260+
lightCreateViewSaveButtonFocusRing: "#F3F4F6",
261+
lightCreateViewSaveButtonBorder: "#D1D5DB",
262+
248263

249264

250265
// colors for dark theme
@@ -482,6 +497,21 @@ export const styles = () => ({
482497
darkToastCloseIconFocusRing: "#374151",
483498
darkToastText: "#9CA3AF",
484499

500+
501+
darkCreateViewCancelButtonBackground: "#1F2937",
502+
darkCreateViewCancelButtonBackgroundHover: "#374151",
503+
darkCreateViewCancelButtonText: "#9CA3AF",
504+
darkCreateViewCancelButtonTextHover: "#FFFFFF",
505+
darkCreateViewCancelButtonFocusRing: "#374151",
506+
darkCreateViewCancelButtonBorder: "#4B5563",
507+
508+
darkCreateViewSaveButtonBackground: "#1F2937",
509+
darkCreateViewSaveButtonBackgroundHover: "#374151",
510+
darkCreateViewSaveButtonText: "#EF4444",
511+
darkCreateViewSaveButtonTextHover: "#FFFFFF",
512+
darkCreateViewSaveButtonFocusRing: "#374151",
513+
darkCreateViewSaveButtonBorder: "#4B5563",
514+
485515
},
486516
boxShadow: {
487517
customLight: "0 4px 8px rgba(0, 0, 0, 0.1)", // Lighter shadow

adminforth/spa/src/views/CreateView.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
<BreadcrumbsWithButtons>
1414
<!-- save and cancle -->
1515
<button @click="$router.back()"
16-
class="af-cancel-button flex items-center py-1 px-3 me-2 text-sm font-medium rounded-default text-gray-900 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-lightPrimary focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700"
16+
class="af-cancel-button flex items-center py-1 px-3 me-2 text-sm font-medium rounded-default text-lightCreateViewCancelButtonText focus:outline-none bg-lightCreateViewCancelButtonBackground rounded border border-lightCreateViewCancelButtonBorder hover:bg-lightCreateViewCancelButtonBackgroundHover hover:text-lightCreateViewCancelButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightCreateViewCancelButtonFocusRing dark:focus:ring-darkCreateViewCancelButtonFocusRing dark:bg-darkCreateViewCancelButtonBackground dark:text-darkCreateViewCancelButtonText dark:border-darkCreateViewCancelButtonBorder dark:hover:text-darkCreateViewCancelButtonTextHover dark:hover:bg-darkCreateViewCancelButtonBackgroundHover"
1717
>
1818
{{ $t('Cancel') }}
1919
</button>
2020

2121
<button
2222
@click="saveRecord"
23-
class="af-save-button flex items-center py-1 px-3 text-sm font-medium rounded-default text-red-600 focus:outline-none bg-white rounded border border-gray-300 hover:bg-gray-100 hover:text-red-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-red-500 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700 disabled:opacity-50"
23+
class="af-save-button flex items-center py-1 px-3 text-sm font-medium rounded-default text-lightCreateViewSaveButtonText focus:outline-none bg-lightCreateViewSaveButtonBackground rounded border border-lightCreateViewSaveButtonBorder hover:bg-lightCreateViewSaveButtonBackgroundHover hover:text-lightCreateViewSaveButtonTextHover focus:z-10 focus:ring-4 focus:ring-lightCreateViewSaveButtonFocusRing dark:focus:ring-darkCreateViewSaveButtonFocusRing dark:bg-darkCreateViewSaveButtonBackground dark:text-darkCreateViewSaveButtonText dark:border-darkCreateViewSaveButtonBorder dark:hover:text-darkCreateViewSaveButtonTextHover dark:hover:bg-darkCreateViewSaveButtonBackgroundHover disabled:opacity-50"
2424
:disabled="saving || (validating && !isValid)"
2525
>
2626
<svg v-if="saving"
27-
aria-hidden="true" class="w-4 h-4 mr-1 text-gray-200 animate-spin dark:text-gray-600 fill-red-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
27+
aria-hidden="true" class="w-4 h-4 mr-1 text-gray-200 animate-spin dark:text-gray-600 fill-lightCreateViewSaveButtonText" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/><path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/></svg>
2828

2929
<IconFloppyDiskSolid v-else class="w-4 h-4 mr-1" />
3030
{{ $t('Save') }}

dev-demo/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ export const admin = new AdminForth({
241241
InputText: "alias:lightFormFieldTextColor",
242242
InputBorder: "alias:lightForm darken",
243243
InputBackgroundHover: "alias:lightInputBackground darken",
244-
InputTextHover: "alias:lightInputText lighten",
244+
InputTextHover: "alias:lightInputText",
245245
InputBorderHover: "alias:lightInputBorder darken",
246246
InputFocusRing: "alias:lightInputBorderHover opacity:0.4",
247247
InputIconColor: "alias:lightPrimary opacity:0.8",
@@ -370,6 +370,20 @@ export const admin = new AdminForth({
370370
ToastCloseIconFocusRing: "alias:lightToastCloseIcon",
371371
ToastText: "alias:lightPrimary inverse",
372372

373+
CreateViewCancelButtonBackground: "alias:lightPrimary",
374+
CreateViewCancelButtonBackgroundHover: "alias:lightCreateViewCancelButtonBackground lighten",
375+
CreateViewCancelButtonText: "alias:lightCreateViewCancelButtonBackground inverse",
376+
CreateViewCancelButtonTextHover: "alias:lightCreateViewCancelButtonText opacity:0.8",
377+
CreateViewCancelButtonFocusRing: "alias:lightCreateViewCancelButtonBackground",
378+
CreateViewCancelButtonBorder: "alias:lightCreateViewCancelButtonBackground darken",
379+
380+
CreateViewSaveButtonBackground: "alias:lightPrimary",
381+
CreateViewSaveButtonBackgroundHover: "alias:lightCreateViewCancelButtonBackground lighten",
382+
CreateViewSaveButtonText: "#DC2626",
383+
CreateViewSaveButtonTextHover: "#B91C1C",
384+
CreateViewSaveButtonFocusRing: "alias:lightCreateViewCancelButtonBackground",
385+
CreateViewSaveButtonBorder: "alias:lightCreateViewCancelButtonBackground darken",
386+
373387
},
374388
dark: {
375389
primary: '#bd1a76',

0 commit comments

Comments
 (0)