From bccd089c7f3ca12fcb062ed8b56bffbc140fad17 Mon Sep 17 00:00:00 2001 From: shrt Date: Sat, 8 Mar 2025 20:30:47 +0100 Subject: [PATCH] loading indicator for editor --- .../article/editor/article-form.tsx | 154 ++++++++++-------- src/styles/globals.css | 16 ++ 2 files changed, 99 insertions(+), 71 deletions(-) diff --git a/src/components/article/editor/article-form.tsx b/src/components/article/editor/article-form.tsx index ac30391..8a6d53d 100644 --- a/src/components/article/editor/article-form.tsx +++ b/src/components/article/editor/article-form.tsx @@ -117,85 +117,97 @@ export default ({ server_article }: { server_article: Article }) => { />
-
-
- - {!form.formState.isDirty && !loading ? ( - <> - - Gespeichert - - ) : ( - <> - - Nicht Gespeichert - - )} - - +
+ +
+
+ + {!form.formState.isDirty && !loading ? ( + <> + + Gespeichert + + ) : ( + <> + + Nicht Gespeichert + + )} + + + {published + ? "Veröffentlicht" + : "Draft (nicht veröffentlicht)"} + +
+ - {published - ? "Veröffentlicht" - : "Draft (nicht veröffentlicht)"} - + ? Hilfe +
- - ? Hilfe - -
- ( - - -
- - { - field.onChange(value); + ( + + +
+ + { + field.onChange(value); + form.handleSubmit(onSubmit)(); + }} + /> +
+
+ + +
+ )} + /> + ( + + + { + field.onChange(categoryId); form.handleSubmit(onSubmit)(); }} /> -
-
+ - -
- )} - /> - ( - - - { - field.onChange(categoryId); - form.handleSubmit(onSubmit)(); - }} - /> - - - - - )} - /> + + + )} + /> +
diff --git a/src/styles/globals.css b/src/styles/globals.css index b53777f..9e47cfe 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -86,3 +86,19 @@ width: var(--radix-popover-trigger-width); max-height: var(--radix-popover-content-available-height); } + +@keyframes loadingBar { + 0% { + transform: scaleX(0); + } + 60% { + transform: scaleX(1); /* Slight overshoot for bounce effect */ + } + 100% { + transform: scaleX(0.2); + } +} + +.saving { + animation: loadingBar 0.8s cubic-bezier(0.3, 0.8, 0.4, 1) infinite alternate; +}