Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

added placeholder cards

Steven Tey448518c16c13
diff --git a/components/placeholder-card.tsx b/components/placeholder-card.tsx
new file mode 100644
index 0000000000..999bb63715
--- /dev/null
+++ b/components/placeholder-card.tsx
@@ -0,0 +1,15 @@
+export default function PlaceholderCard() {
+ return (
+ <div className="flex items-center border border-gray-200 hover:border-black p-3 rounded-md transition-all">
+ <div className="w-10 h-10 rounded-full mr-2 bg-gray-200 animate-pulse" />
+ <div>
+ <div className="flex items-center space-x-2 mb-2.5">
+ <div className="w-28 h-6 rounded-md bg-gray-200 animate-pulse" />
+ <div className="w-6 h-6 rounded-full bg-gray-200 animate-pulse" />
+ <div className="w-20 h-6 rounded-md bg-gray-200 animate-pulse" />
+ </div>
+ <div className="w-72 h-4 rounded-md bg-gray-200 animate-pulse" />
+ </div>
+ </div>
+ );
+}
diff --git a/pages/index.tsx b/pages/index.tsx
index 5199604cfd..37bf4a8210 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -3,6 +3,7 @@ import useLocalStorage from "@/lib/use-local-storage";
import VercelEdgeFunctions from "@/components/vercel-edge-functions";
import LinkCard from "@/components/link-card";
import LoadingDots from "@/components/loading-dots";
+import PlaceholderCard from "@/components/placeholder-card";
export default function Home() {
const [saving, setSaving] = useState(false);
@@ -13,7 +14,7 @@ export default function Home() {
);
return (
- <main className="flex flex-col items-center justify-center min-h-screen">
+ <main className="my-20 max-w-md mx-auto">
<div className="my-5 text-center max-w-md">
<h1 className="text-6xl font-bold">Dub</h1>
<p className="text-gray-600 text-xl mt-5">
@@ -32,7 +33,6 @@ export default function Home() {
</p>
</div>
<form
- className="w-96"
onSubmit={async (e) => {
e.preventDefault();
setSaving(true);
@@ -74,10 +74,14 @@ export default function Home() {
</div>
</form>
- <div className="grid gap-2 mt-3 w-96">
- {hashes.map(({ key, url }) => (
- <LinkCard key={key} _key={key} url={url} />
- ))}
+ <div className="grid gap-2 mt-3">
+ {hashes.length > 0
+ ? hashes.map(({ key, url }) => (
+ <LinkCard key={key} _key={key} url={url} />
+ ))
+ : Array.from({ length: 3 }).map((_, i) => (
+ <PlaceholderCard key={i} />
+ ))}
</div>
</main>
);