Skip to content

Commit c0ca44a

Browse files
sstrubbergAlessandra Davila
and
Alessandra Davila
authoredFeb 9, 2022
chore(button): skeleton size prop audit (#10559)
Co-authored-by: Alessandra Davila <aledavila@ibm.com>
1 parent addd1a7 commit c0ca44a

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed
 

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

-3
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,6 @@ Map {
339339
"render": [Function],
340340
},
341341
"ButtonSkeleton" => Object {
342-
"defaultProps": Object {
343-
"small": false,
344-
},
345342
"propTypes": Object {
346343
"className": Object {
347344
"type": "string",

‎packages/react/src/components/Button/Button.Skeleton.js

+20-15
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@ import React from 'react';
1010
import cx from 'classnames';
1111
import { useFeatureFlag } from '../FeatureFlags';
1212
import { usePrefix } from '../../internal/usePrefix';
13+
import * as FeatureFlags from '@carbon/feature-flags';
1314

14-
const ButtonSkeleton = ({ className, small, href, size, ...rest }) => {
15+
const ButtonSkeleton = ({
16+
className,
17+
small = false,
18+
href,
19+
size = FeatureFlags.enabled('enable-v11-release') ? 'lg' : 'default',
20+
...rest
21+
}) => {
1522
const enabled = useFeatureFlag('enable-v11-release');
1623
const prefix = usePrefix();
1724

@@ -54,25 +61,23 @@ ButtonSkeleton.propTypes = {
5461
* For `default` buttons, this prop can remain unspecified or use `default`.
5562
* In the next major release of Carbon, `default`, `field`, and `small` will be removed
5663
*/
57-
size: PropTypes.oneOf([
58-
'default',
59-
'field',
60-
'small',
61-
'sm',
62-
'md',
63-
'lg',
64-
'xl',
65-
'2xl',
66-
]),
64+
size: FeatureFlags.enabled('enable-v11-release')
65+
? PropTypes.oneOf(['sm', 'md', 'lg', 'xl', '2xl'])
66+
: PropTypes.oneOf([
67+
'default',
68+
'field',
69+
'small',
70+
'sm',
71+
'md',
72+
'lg',
73+
'xl',
74+
'2xl',
75+
]),
6776

6877
/**
6978
* Specify whether the Button should be a small variant
7079
*/
7180
small: PropTypes.bool,
7281
};
7382

74-
ButtonSkeleton.defaultProps = {
75-
small: false,
76-
};
77-
7883
export default ButtonSkeleton;

0 commit comments

Comments
 (0)
Please sign in to comment.