From c5fb6030fbeec03c94e171fb13e7516e1c971caf Mon Sep 17 00:00:00 2001 From: Peeyush Tiwari <105871155+Peeyush2006@users.noreply.github.com> Date: Sun, 5 Jul 2026 12:07:38 +0530 Subject: [PATCH 1/2] Add Skeleton component for loading placeholders The Skeleton component serves as a loading placeholder with customizable dimensions and shapes. --- app/components/Skeleton/Skeleton.tsx | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/components/Skeleton/Skeleton.tsx diff --git a/app/components/Skeleton/Skeleton.tsx b/app/components/Skeleton/Skeleton.tsx new file mode 100644 index 0000000..710b679 --- /dev/null +++ b/app/components/Skeleton/Skeleton.tsx @@ -0,0 +1,56 @@ +import styles from "./Skeleton.module.css"; + +type SkeletonVariant = "text" | "rect" | "circle"; + +type SkeletonProps = { + /** Width as a CSS value. Numbers are treated as px. Defaults to 100%. */ + width?: string | number; + /** Height as a CSS value. Numbers are treated as px. Defaults to 1rem. */ + height?: string | number; + /** Visual shape of the placeholder. */ + variant?: SkeletonVariant; + /** Optional border-radius override (CSS value / px number). */ + radius?: string | number; + /** Extra class names to merge with the component styles. */ + className?: string; +}; + +const toCssSize = (value?: string | number) => + typeof value === "number" ? `${value}px` : value; + +/** + * Skeleton — a lightweight, theme-aware loading placeholder. + * + * Use it while data is loading to reduce layout shift and improve the + * perceived performance of data-heavy views (tables, cards, charts). + * + * @example + * + * + * + */ +export function Skeleton({ + width = "100%", + height = "1rem", + variant = "text", + radius, + className, +}: SkeletonProps) { + return ( +