[WEB-4738] feat: add Skeleton component with respective stories in propel (#7704)

*  feat: add Skeleton component with respective stories in propel

* 🚨 fix: lint issues

* ♻️ refactor : enhance Skeleton component with improved props and structure

*  feat: add Skeleton component entry to package.json

* 🚨 fix: lint

* ♻️ refactor: rename Skeleton to skeleton

* fix: rename fixes

* ♻️ refactor: rename skeleton

* 🚨 fix: lint

* ♻️ refactor: add skeleton entry to tsdown config and package.json

* ♻️  refactor: sorted propel exports

---------

Co-authored-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
This commit is contained in:
Jayash Tripathy 2025-09-05 15:51:05 +05:30 committed by GitHub
parent a696b6039c
commit ff181e566f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 72 additions and 0 deletions

View file

@ -27,6 +27,7 @@
"./icons": "./dist/icons/index.js",
"./menu": "./dist/menu/index.js",
"./popover": "./dist/popover/index.js",
"./skeleton": "./dist/skeleton/index.js",
"./styles/fonts": "./dist/styles/fonts/index.css",
"./switch": "./dist/switch/index.js",
"./table": "./dist/table/index.js",

View file

@ -0,0 +1 @@
export * from "./root";

View file

@ -0,0 +1,36 @@
import React from "react";
// helpers
import { cn } from "../utils/classname";
type SkeletonProps = {
children: React.ReactNode;
className?: string;
ariaLabel?: string;
};
const SkeletonRoot = ({ children, className = "", ariaLabel = "Loading content" }: SkeletonProps) => (
<div data-slot="skeleton" className={cn("animate-pulse", className)} role="status" aria-label={ariaLabel}>
{children}
</div>
);
type ItemProps = {
height?: string;
width?: string;
className?: string;
};
const SkeletonItem: React.FC<ItemProps> = ({ height = "auto", width = "auto", className = "" }) => (
<div
data-slot="skeleton-item"
className={cn("rounded-md bg-custom-background-80", className)}
style={{ height, width }}
/>
);
const Skeleton = Object.assign(SkeletonRoot, { Item: SkeletonItem });
SkeletonRoot.displayName = "plane-ui-skeleton";
SkeletonItem.displayName = "plane-ui-skeleton-item";
export { Skeleton };

View file

@ -0,0 +1,33 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Skeleton } from "./index";
const meta: Meta<typeof Skeleton> = {
title: "Components/Skeleton",
component: Skeleton,
parameters: {
layout: "centered",
},
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
render: () => (
<Skeleton className="w-80 flex flex-col gap-2">
<Skeleton.Item height="40px" width="100%" />
</Skeleton>
),
};
export const Card: Story = {
render: () => (
<Skeleton className="w-80 flex flex-col gap-4">
<Skeleton.Item height="200px" width="100%" />
<div className="flex flex-col gap-2">
<Skeleton.Item height="20px" width="50%" />
<Skeleton.Item height="20px" width="30%" />
</div>
</Skeleton>
),
};

View file

@ -13,6 +13,7 @@ export default defineConfig({
"src/icons/index.ts",
"src/menu/index.ts",
"src/popover/index.ts",
"src/skeleton/index.ts",
"src/switch/index.ts",
"src/table/index.ts",
"src/tabs/index.ts",