diff --git a/components/ui/loader.tsx b/components/ui/loader.tsx
new file mode 100644
index 0000000..131ab8d
--- /dev/null
+++ b/components/ui/loader.tsx
@@ -0,0 +1,96 @@
+import { cn } from "@/lib/utils";
+import type { HTMLAttributes } from "react";
+
+interface LoaderIconProps {
+ size?: number;
+}
+
+const LoaderIcon = ({ size = 16 }: LoaderIconProps) => (
+
+);
+
+export type LoaderProps = HTMLAttributes & {
+ size?: number;
+};
+
+export const Loader = ({ className, size = 16, ...props }: LoaderProps) => (
+
+
+
+);
diff --git a/src/App.tsx b/src/App.tsx
index 77f270c..e1eb059 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -7,6 +7,7 @@ import {
import createTailwindCdnPlugin from "@reacteditor/plugin-tailwind-cdn";
import { createConfig } from "@/editor/config";
import { ShopifyProvider } from "@/editor/contexts/shopify-context";
+import { Loader } from "@/components/ui/loader";
import schemaJson from "../app.schema.json";
type Pages = Record;
@@ -27,6 +28,7 @@ function readPathname() {
export default function App() {
const pages = schemaJson as Pages;
const [currentPath, setCurrentPath] = useState(readPathname);
+ const [isPublishing, setIsPublishing] = useState(false);
useEffect(() => {
const onPop = () => setCurrentPath(readPathname());
@@ -49,16 +51,18 @@ export default function App() {
);
const handlePublish = useCallback((data: any, route?: string) => {
+ setIsPublishing(true);
if (typeof window !== "undefined" && window.parent !== window) {
window.parent.postMessage(
{ type: "PUBLISH", data: { data, route } },
"*",
);
}
+ setTimeout(() => setIsPublishing(false), 1000);
}, []);
return (
-
+
+ {isPublishing && (
+
+
+
+ )}
);
}