refractor web components to kebab case

This commit is contained in:
Aman Varshney
2025-05-12 23:48:40 +05:30
parent 49f4330f96
commit 8b14dc4509
12 changed files with 16 additions and 16 deletions

View File

@@ -0,0 +1,45 @@
"use client";
import { cn } from "@/lib/utils";
import { useEffect, useState } from "react";
const NpmPackage = () => {
const [version, setVersion] = useState("");
const [versionLoading, setVersionLoading] = useState(true);
useEffect(() => {
const getLatestVersion = async () => {
setVersionLoading(true);
try {
const res = await fetch(
"https://registry.npmjs.org/create-better-t-stack/latest",
);
if (!res.ok) throw new Error("Failed to fetch version");
const data = await res.json();
setVersion(data.version);
} catch (error) {
console.error("Error fetching NPM version:", error);
setVersion("?.?.?");
} finally {
setVersionLoading(false);
}
};
getLatestVersion();
}, []);
return (
<div className="mt-2 flex items-center justify-center">
<span
className={cn(
"mr-2 inline-block h-5 w-3 bg-primary",
versionLoading && "animate-pulse",
)}
/>
<span className="font-mono text-muted-foreground text-xl">
{versionLoading ? "[v?.?.?]" : `[v${version}]`}
</span>
</div>
);
};
export default NpmPackage;