Skip to content

Commit

Permalink
chore: add as prop to skeleton for quick usage
Browse files Browse the repository at this point in the history
closes #68
  • Loading branch information
zaaakher committed Aug 14, 2024
1 parent ca5467e commit 28bf8b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/components/elements/skeleton/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
animation?: "none" | "pulse" | "shimmer";
content?: any;
fade?: "top" | "bottom" | "left" | "right";
as?: "div" | "input";
}

function Skeleton({
className,
content,
animation = "pulse",
fade,
as = "div",
...props
}: SkeletonProps) {
const animationStyles = {
Expand All @@ -29,13 +31,19 @@ function Skeleton({
left: "hawa-mask-fade-left ",
};

const styledAs = {
div: "",
input: "!h-[38px] !w-full",
};

return (
<div
className={cn(
animationStyles[animation],
content &&
"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
fade && fadeStyle[fade],
styledAs[as],
className,
)}
{...props}
Expand Down

0 comments on commit 28bf8b8

Please sign in to comment.