Skip to content

Commit

Permalink
Add Spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
mirhamasala committed Nov 11, 2023
1 parent 8333349 commit d68ca5d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/components/Map.tsx
Expand Up @@ -7,6 +7,7 @@ import {
} from "@react-google-maps/api";

import { Link } from "@/components/Link";
import { Spinner } from "@/components/Spinner";
import { type PublishedSpotWithCategoryAndCity } from "@/types/spots.type";

type Props = {
Expand Down Expand Up @@ -159,7 +160,7 @@ function WrappedMap(props: Props) {
if (!isLoaded)
return (
<div className="min-h-[40vh] rounded-md bg-white/90 px-3 py-2 ring-1 ring-zinc-900/5 dark:bg-zinc-800/90 dark:ring-white/20">
Loading...
<Spinner />
</div>
);

Expand Down
41 changes: 22 additions & 19 deletions src/components/Spinner.jsx
@@ -1,23 +1,26 @@
export function Spinner() {
return (
<svg
className="mr-3 h-5 w-5 animate-spin text-white"
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
<div className="flex items-center gap-2 text-zinc-800 dark:text-zinc-300">
<span>Loading</span>
<svg
className="mr-3 h-5 w-5 animate-spin text-white"
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
</div>
);
}

1 comment on commit d68ca5d

@vercel
Copy link

@vercel vercel bot commented on d68ca5d Nov 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.