-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new scenarios for skeleton
- Loading branch information
Showing
11 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/design-system/src/components/Skeleton/Primitive/Skeleton.Primitive.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
export * from './Skeleton'; | ||
import SkeletonButton from './variations/SkeletonButton'; | ||
import SkeletonButtonIcon from './variations/SkeletonButtonIcon'; | ||
import SkeletonHeading from './variations/SkeletonHeading'; | ||
import SkeletonInput from './variations/SkeletonInput'; | ||
import SkeletonParagraph from './variations/SkeletonParagraph'; | ||
import SkeletonSized from './variations/SkeletonSized'; | ||
|
||
export * from './Skeleton'; | ||
|
||
export { SkeletonHeading, SkeletonButtonIcon, SkeletonButton, SkeletonParagraph, SkeletonInput }; | ||
export { | ||
SkeletonHeading, | ||
SkeletonButtonIcon, | ||
SkeletonButton, | ||
SkeletonParagraph, | ||
SkeletonInput, | ||
SkeletonSized, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/design-system/src/components/Skeleton/variations/SkeletonSized.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.skeleton-sized-circle { | ||
border-radius: 50%; | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/design-system/src/components/Skeleton/variations/SkeletonSized.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { forwardRef, Ref } from 'react'; | ||
|
||
import classNames from 'classnames'; | ||
|
||
import SkeletonPrimitive, { SkeletonPrimitiveProps } from '../Primitive/Skeleton.Primitive'; | ||
|
||
import style from './SkeletonSized.module.scss'; | ||
|
||
export type SkeletonSizedProps = Omit<SkeletonPrimitiveProps, 'className'> & { | ||
height?: number; | ||
width?: number; | ||
isCircle?: boolean; | ||
}; | ||
|
||
const SkeletonSized = forwardRef( | ||
( | ||
{ height = 1.4, width = 2, 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} | ||
/> | ||
); | ||
}, | ||
); | ||
SkeletonSized.displayName = 'SkeletonSized'; | ||
|
||
export default SkeletonSized; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters