-
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(design-system): Skeleton update (#5052)
- Loading branch information
Showing
15 changed files
with
178 additions
and
16 deletions.
There are no files selected for viewing
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,8 @@ | ||
--- | ||
'@talend/design-system': minor | ||
--- | ||
|
||
feat(design-system): There is some limitation when designing skeletons | ||
|
||
Add new width for header and paragraph skeletons | ||
Add new SkeletonSized that can be shaped for any needs |
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, | ||
}; |
2 changes: 2 additions & 0 deletions
2
packages/design-system/src/components/Skeleton/variations/SkeletonButton.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
2 changes: 2 additions & 0 deletions
2
packages/design-system/src/components/Skeleton/variations/SkeletonButtonIcon.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
10 changes: 6 additions & 4 deletions
10
packages/design-system/src/components/Skeleton/variations/SkeletonHeading.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
6 changes: 4 additions & 2 deletions
6
packages/design-system/src/components/Skeleton/variations/SkeletonInput.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
9 changes: 6 additions & 3 deletions
9
packages/design-system/src/components/Skeleton/variations/SkeletonParagraph.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
5 changes: 5 additions & 0 deletions
5
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,5 @@ | ||
@use '~@talend/design-tokens/lib/tokens'; | ||
|
||
.skeleton-sized-circle { | ||
border-radius: tokens.$coral-radius-round; | ||
} |
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