Skip to content

Commit

Permalink
chore: changed skeleton "sized" variant width and height props to str…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
dlcaldeira committed Feb 2, 2024
1 parent 56d0d0a commit 6340ed4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-balloons-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/design-system': minor
---

chore: changed skeleton "sized" variant width and height props to strings
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,24 @@ import SkeletonPrimitive, { SkeletonPrimitiveProps } from '../Primitive/Skeleton
import style from './SkeletonSized.module.scss';

export type SkeletonSizedProps = Omit<SkeletonPrimitiveProps, 'className'> & {
height?: number;
width?: number;
height?: string;
width?: string;
isCircle?: boolean;
};

const SkeletonSized = forwardRef(
(
{ height = 1.4, width = 2, isCircle, ...props }: SkeletonSizedProps,
{ height = '1.4rem', width = '2rem', isCircle, ...props }: SkeletonSizedProps,
ref: Ref<HTMLSpanElement>,
) => {
return (
<SkeletonPrimitive
// @ts-expect-error style is valid
style={{ height: `${height}rem`, width: `${width}rem` }}
className={classNames({ [style['skeleton-sized-circle']]: isCircle })}
{...props}
ref={ref}
/>
);
},
) => (
<SkeletonPrimitive
// @ts-expect-error style is valid
style={{ height, width }}
className={classNames({ [style['skeleton-sized-circle']]: isCircle })}
{...props}
ref={ref}
/>
),
);
SkeletonSized.displayName = 'SkeletonSized';

Expand Down
12 changes: 2 additions & 10 deletions packages/design-system/src/stories/feedback/Skeleton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,8 @@ SkeletonParagraphStory.argTypes = {
export const SkeletonSizedStory = SkeletonSizedTemplate.bind({});
SkeletonSizedStory.args = {
isCircle: true,
};
SkeletonSizedStory.argTypes = {
height: {
control: { type: 'number' },
defaultValue: 10,
},
width: {
control: { type: 'number' },
defaultValue: 10,
},
height: '3rem',
width: '20%',
};

export const SkeletonInputStory = SkeletonInputTemplate.bind({});
Expand Down

0 comments on commit 6340ed4

Please sign in to comment.