-
Notifications
You must be signed in to change notification settings - Fork 359
Expand file tree
/
Copy pathTableCellSkeleton.tsx
More file actions
37 lines (33 loc) · 1.18 KB
/
TableCellSkeleton.tsx
File metadata and controls
37 lines (33 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from "react";
import cx from "classnames";
import TableCell from "../TableCell/TableCell";
import { Skeleton } from "@vibe/core";
import styles from "./TableCellSkeleton.module.scss";
import { type VibeComponentProps, getStyle } from "@vibe/shared";
import { type TableLoadingStateType } from "../Table/Table";
import { getSkeletonType } from "../Table/tableHelpers";
import { camelCase } from "es-toolkit";
export interface TableCellSkeletonProps extends VibeComponentProps {
/**
* The type of loading state for the skeleton.
*/
type?: TableLoadingStateType;
/**
* If true, renders a shorter skeleton for text-based loading states.
*/
short?: boolean;
}
const TableCellSkeleton: React.FC<TableCellSkeletonProps> = ({ type = "long-text" }) => {
const isText = ["long-text", "medium-text"].includes(type);
return (
<TableCell>
<Skeleton
type={getSkeletonType(type)}
wrapperClassName={cx(styles.tableCellSkeletonWrapper, getStyle(styles, camelCase(type)))}
className={cx(styles.tableCellSkeleton, { [getStyle(styles, camelCase(type))]: !isText })}
fullWidth
/>
</TableCell>
);
};
export default TableCellSkeleton;