Skip to content

Commit ddbd8f7

Browse files
Gururajj77ariellalgilmorepreetibansalui
authored
fix: skeleton parity (#19332)
* fix: skeleton parity * chore: storybook update * Update packages/web-components/src/components/skeleton-text/skeleton-text.stories.ts Co-authored-by: Ariella Gilmore <[email protected]> * Update packages/web-components/src/components/skeleton-text/skeleton-text.stories.ts Co-authored-by: Ariella Gilmore <[email protected]> * chore: cleanup + snapshots * chore: storybook cleanup again :-'( * Update packages/web-components/src/components/skeleton-text/skeleton-text.stories.ts Co-authored-by: Ariella Gilmore <[email protected]> --------- Co-authored-by: Ariella Gilmore <[email protected]> Co-authored-by: Preeti Bansal <[email protected]>
1 parent 45c66db commit ddbd8f7

File tree

4 files changed

+20
-36
lines changed

4 files changed

+20
-36
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7471,9 +7471,6 @@ Map {
74717471
"className": Object {
74727472
"type": "string",
74737473
},
7474-
"style": Object {
7475-
"type": "object",
7476-
},
74777474
},
74787475
},
74797476
"SkeletonPlaceholder" => Object {

packages/react/src/components/SkeletonIcon/SkeletonIcon.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ export interface SkeletonIconProps {
1414
* Specify an optional className to add.
1515
*/
1616
className?: string;
17-
18-
/**
19-
* The CSS styles.
20-
*/
21-
style?: React.CSSProperties;
2217
}
2318

2419
const SkeletonIcon: React.FC<SkeletonIconProps> = ({ className, ...other }) => {
@@ -36,11 +31,6 @@ SkeletonIcon.propTypes = {
3631
* Specify an optional className to add.
3732
*/
3833
className: PropTypes.string,
39-
40-
/**
41-
* The CSS styles.
42-
*/
43-
style: PropTypes.object,
4434
};
4535

4636
export default SkeletonIcon;

packages/web-components/src/components/skeleton-text/skeleton-text.stories.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,18 @@
66
*/
77

88
import { html } from 'lit';
9-
import { ifDefined } from 'lit/directives/if-defined.js';
10-
import { SKELETON_TEXT_TYPE } from './skeleton-text';
11-
12-
const types = {
13-
Regular: null,
14-
[`Heading (${SKELETON_TEXT_TYPE.HEADING})`]: SKELETON_TEXT_TYPE.HEADING,
15-
};
169

1710
const args = {
18-
type: null,
19-
paragraph: true,
11+
paragraph: false,
12+
heading: false,
2013
lineCount: 3,
2114
width: '100%',
2215
};
2316

2417
const argTypes = {
25-
type: {
26-
control: 'select',
27-
description: 'Indicate the type of skeleton text, heading or regular.',
28-
options: types,
18+
heading: {
19+
control: 'boolean',
20+
description: 'Set to true to use heading style',
2921
},
3022
paragraph: {
3123
control: 'boolean',
@@ -43,23 +35,19 @@ const argTypes = {
4335
};
4436

4537
export const Default = {
38+
args,
39+
argTypes,
4640
parameters: {
4741
percy: {
4842
skip: true,
4943
},
5044
},
51-
render: () => html`<cds-skeleton-text></cds-skeleton-text>`,
52-
};
53-
54-
export const Playground = {
55-
args,
56-
argTypes,
5745
render: (args) => {
58-
const { type, paragraph, lineCount, width } = args ?? {};
46+
const { heading, paragraph, lineCount, width } = args ?? {};
5947
return html`
6048
<cds-skeleton-text
61-
type="${ifDefined(type)}"
6249
?paragraph="${paragraph}"
50+
?heading="${heading}"
6351
lineCount="${lineCount}"
6452
width="${width}">
6553
</cds-skeleton-text>

packages/web-components/src/components/skeleton-text/skeleton-text.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,17 @@ class CDSSkeletonText extends LitElement {
3535

3636
/**
3737
* The type of skeleton text.
38+
* @deprecated Use the `heading` property instead.
3839
*/
3940
@property({ reflect: true })
4041
type = SKELETON_TEXT_TYPE.REGULAR;
4142

43+
/**
44+
* Determines if the skeleton text should be rendered as a heading.
45+
*/
46+
@property({ type: Boolean, reflect: true })
47+
heading = false;
48+
4249
/**
4350
* width (in px or %) of single line of text or max-width of paragraph lines
4451
*/
@@ -58,10 +65,12 @@ class CDSSkeletonText extends LitElement {
5865
lineCount = 3;
5966

6067
render() {
61-
const { optionalClasses, paragraph, lineCount, type, width } = this;
68+
const { optionalClasses, paragraph, lineCount, type, width, heading } =
69+
this;
6270
let defaultClasses = {
6371
[`${prefix}--skeleton__text`]: true,
64-
[`${prefix}--skeleton__heading`]: type === SKELETON_TEXT_TYPE.HEADING,
72+
[`${prefix}--skeleton__heading`]:
73+
heading || type === SKELETON_TEXT_TYPE.HEADING,
6574
};
6675

6776
if (optionalClasses) {

0 commit comments

Comments
 (0)