Beautiful map components. 100% Free, Zero config, one command setup.
TypeScript
updates: analytics-card
Anmol7ff218e8acb9
diff --git a/public/r/analytics-card.json b/public/r/analytics-card.jsonindex acfa054..43da197 100644--- a/public/r/analytics-card.json+++ b/public/r/analytics-card.json@@ -7,13 +7,12 @@"lucide-react"],"registryDependencies": [- "@mapcn/map",- "button"+ "@mapcn/map"],"files": [{"path": "src/registry/blocks/analytics-card/page.tsx",- "content": "\"use client\";\n\nimport { TrendingUp } from \"lucide-react\";\n\nimport { Map, MapGeoJSON, MapMarker, MarkerContent } from \"@/components/ui/map\";\nimport { Button } from \"@/components/ui/button\";\nimport { totalVisitors, visitorGrowth, visitorLocations } from \"./data\";\n\n// Country borders from a public CDN, or swap in your own GeoJSON.\nconst WORLD_GEOJSON =\n \"https://cdn.jsdelivr.net/gh/nvkelso/[email protected]/geojson/ne_110m_admin_0_countries.geojson\";\n\nfunction bubbleSize(visitors: number) {\n return Math.round(10 + Math.sqrt(visitors) * 2.2);\n}\n\nexport default function Page() {\n return (\n <div className=\"flex min-h-screen items-center justify-center p-8\">\n <div className=\"bg-card relative aspect-16/10 w-full max-w-md overflow-hidden rounded-xl border shadow-sm\">\n <div className=\"absolute inset-0\">\n <Map\n center={[1, 30]}\n scrollZoom={false}\n dragRotate={false}\n dragPan={false}\n doubleClickZoom={false}\n pitchWithRotate={false}\n blank\n >\n <MapGeoJSON data={WORLD_GEOJSON} linePaint={false} />\n {visitorLocations.map((location) => {\n const size = bubbleSize(location.visitors);\n return (\n <MapMarker\n key={location.city}\n longitude={location.lng}\n latitude={location.lat}\n >\n <MarkerContent className=\"cursor-default\">\n <span\n className=\"bg-chart-2/80 block rounded-full\"\n style={{ width: size, height: size }}\n />\n </MarkerContent>\n </MapMarker>\n );\n })}\n </Map>\n </div>\n\n <div\n className=\"from-card to-card/0 pointer-events-none absolute inset-x-0 top-0 z-10 h-24 rounded-t-xl bg-linear-to-b [mask-image:linear-gradient(to_bottom,black_55%,transparent)] backdrop-blur-[2px]\"\n aria-hidden\n />\n\n <div className=\"relative z-20 flex items-start justify-between gap-3 p-4\">\n <div>\n <h2 className=\"text-foreground text-lg font-medium tracking-tight\">\n Analytics\n </h2>\n <div className=\"mt-1.5 flex items-center gap-2\">\n <p className=\"text-muted-foreground text-xs font-medium\">\n <span className=\"tabular-nums\">{totalVisitors}</span> visitors\n </p>\n <span className=\"inline-flex items-center gap-0.5 text-xs font-medium\">\n <TrendingUp className=\"size-2.5\" />\n {visitorGrowth}\n </span>\n </div>\n </div>\n\n <Button variant=\"outline\" size=\"xs\" className=\"h-7 px-2.5\">\n View Analytics\n </Button>\n </div>\n </div>\n </div>\n );\n}\n",+ "content": "\"use client\";\n\nimport { TrendingUp } from \"lucide-react\";\n\nimport { Map, MapGeoJSON, MapMarker, MarkerContent } from \"@/components/ui/map\";\nimport { totalVisitors, visitorGrowth, visitorLocations } from \"./data\";\n\n// Country borders from a public CDN, or swap in your own GeoJSON.\nconst WORLD_GEOJSON =\n \"https://cdn.jsdelivr.net/gh/nvkelso/[email protected]/geojson/ne_110m_admin_0_countries.geojson\";\n\nfunction bubbleSize(visitors: number) {\n return Math.round(10 + Math.sqrt(visitors) * 2.2);\n}\n\nexport default function Page() {\n return (\n <div className=\"flex min-h-screen items-center justify-center p-8\">\n <div className=\"bg-card relative aspect-16/10 w-full max-w-md overflow-hidden rounded-xl border shadow-sm\">\n <div className=\"absolute inset-0\">\n <Map\n center={[1, 30]}\n scrollZoom={false}\n dragRotate={false}\n dragPan={false}\n doubleClickZoom={false}\n pitchWithRotate={false}\n className=\"[&_.maplibregl-canvas]:cursor-default! [&_.maplibregl-canvas-container]:cursor-default!\"\n blank\n >\n <MapGeoJSON data={WORLD_GEOJSON} linePaint={false} />\n {visitorLocations.map((location) => {\n const size = bubbleSize(location.visitors);\n return (\n <MapMarker\n key={location.city}\n longitude={location.lng}\n latitude={location.lat}\n >\n <MarkerContent className=\"cursor-default\">\n <span\n className=\"bg-chart-2/80 block rounded-full\"\n style={{ width: size, height: size }}\n />\n </MarkerContent>\n </MapMarker>\n );\n })}\n </Map>\n </div>\n\n <div\n className=\"from-card via-card/85 to-card/0 pointer-events-none absolute inset-x-0 top-0 z-10 h-24 rounded-t-xl bg-linear-to-b mask-[linear-gradient(to_bottom,black_70%,transparent)] backdrop-blur-[2px]\"\n aria-hidden\n />\n\n <div className=\"relative z-20 flex items-start justify-between gap-3 p-4\">\n <div>\n <h2 className=\"text-foreground text-lg font-medium tracking-tight\">\n Analytics\n </h2>\n <p className=\"text-muted-foreground mt-1 text-xs font-medium\">\n Last 30 days\n </p>\n </div>\n\n <div className=\"text-right\">\n <p className=\"text-foreground text-lg font-medium tracking-tight tabular-nums\">\n {totalVisitors}\n </p>\n <span className=\"text-muted-foreground mt-1 inline-flex items-center gap-0.5 text-xs font-medium\">\n <TrendingUp className=\"size-2.5\" />\n {visitorGrowth} visitors\n </span>\n </div>\n </div>\n </div>\n </div>\n );\n}\n","type": "registry:page","target": "app/analytics-card/page.tsx"},diff --git a/public/r/registry.json b/public/r/registry.jsonindex 37f1a4b..0c30700 100644--- a/public/r/registry.json+++ b/public/r/registry.json@@ -180,8 +180,7 @@"lucide-react"],"registryDependencies": [- "@mapcn/map",- "button"+ "@mapcn/map"],"files": [{diff --git a/registry.json b/registry.jsonindex 37f1a4b..0c30700 100644--- a/registry.json+++ b/registry.json@@ -180,8 +180,7 @@"lucide-react"],"registryDependencies": [- "@mapcn/map",- "button"+ "@mapcn/map"],"files": [{diff --git a/src/registry/blocks/analytics-card/page.tsx b/src/registry/blocks/analytics-card/page.tsxindex 50056e0..fb49bc6 100644--- a/src/registry/blocks/analytics-card/page.tsx+++ b/src/registry/blocks/analytics-card/page.tsx@@ -3,7 +3,6 @@import { TrendingUp } from "lucide-react";import { Map, MapGeoJSON, MapMarker, MarkerContent } from "@/registry/map";-import { Button } from "@/components/ui/button";import { totalVisitors, visitorGrowth, visitorLocations } from "./data";// Country borders from a public CDN, or swap in your own GeoJSON.@@ -26,6 +25,7 @@ export default function Page() {dragPan={false}doubleClickZoom={false}pitchWithRotate={false}+ className="[&_.maplibregl-canvas]:cursor-default! [&_.maplibregl-canvas-container]:cursor-default!"blank><MapGeoJSON data={WORLD_GEOJSON} linePaint={false} />@@ -50,7 +50,7 @@ export default function Page() {</div><div- className="from-card to-card/0 pointer-events-none absolute inset-x-0 top-0 z-10 h-24 rounded-t-xl bg-linear-to-b [mask-image:linear-gradient(to_bottom,black_55%,transparent)] backdrop-blur-[2px]"+ className="from-card via-card/85 to-card/0 pointer-events-none absolute inset-x-0 top-0 z-10 h-24 rounded-t-xl bg-linear-to-b mask-[linear-gradient(to_bottom,black_70%,transparent)] backdrop-blur-[2px]"aria-hidden/>@@ -59,20 +59,20 @@ export default function Page() {<h2 className="text-foreground text-lg font-medium tracking-tight">Analytics</h2>- <div className="mt-1.5 flex items-center gap-2">- <p className="text-muted-foreground text-xs font-medium">- <span className="tabular-nums">{totalVisitors}</span> visitors- </p>- <span className="inline-flex items-center gap-0.5 text-xs font-medium">- <TrendingUp className="size-2.5" />- {visitorGrowth}- </span>- </div>+ <p className="text-muted-foreground mt-1 text-xs font-medium">+ Last 30 days+ </p></div>- <Button variant="outline" size="xs" className="h-7 px-2.5">- View Analytics- </Button>+ <div className="text-right">+ <p className="text-foreground text-lg font-medium tracking-tight tabular-nums">+ {totalVisitors}+ </p>+ <span className="text-muted-foreground mt-1 inline-flex items-center gap-0.5 text-xs font-medium">+ <TrendingUp className="size-2.5" />+ {visitorGrowth} visitors+ </span>+ </div></div></div></div>