Skip to content

Commit

Permalink
chore(button): skeleton size prop audit (#10559)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <[email protected]>
  • Loading branch information
sstrubberg and Alessandra Davila authored Feb 9, 2022
1 parent addd1a7 commit c0ca44a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
3 changes: 0 additions & 3 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ Map {
"render": [Function],
},
"ButtonSkeleton" => Object {
"defaultProps": Object {
"small": false,
},
"propTypes": Object {
"className": Object {
"type": "string",
Expand Down
35 changes: 20 additions & 15 deletions packages/react/src/components/Button/Button.Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ import React from 'react';
import cx from 'classnames';
import { useFeatureFlag } from '../FeatureFlags';
import { usePrefix } from '../../internal/usePrefix';
import * as FeatureFlags from '@carbon/feature-flags';

const ButtonSkeleton = ({ className, small, href, size, ...rest }) => {
const ButtonSkeleton = ({
className,
small = false,
href,
size = FeatureFlags.enabled('enable-v11-release') ? 'lg' : 'default',
...rest
}) => {
const enabled = useFeatureFlag('enable-v11-release');
const prefix = usePrefix();

Expand Down Expand Up @@ -54,25 +61,23 @@ ButtonSkeleton.propTypes = {
* For `default` buttons, this prop can remain unspecified or use `default`.
* In the next major release of Carbon, `default`, `field`, and `small` will be removed
*/
size: PropTypes.oneOf([
'default',
'field',
'small',
'sm',
'md',
'lg',
'xl',
'2xl',
]),
size: FeatureFlags.enabled('enable-v11-release')
? PropTypes.oneOf(['sm', 'md', 'lg', 'xl', '2xl'])
: PropTypes.oneOf([
'default',
'field',
'small',
'sm',
'md',
'lg',
'xl',
'2xl',
]),

/**
* Specify whether the Button should be a small variant
*/
small: PropTypes.bool,
};

ButtonSkeleton.defaultProps = {
small: false,
};

export default ButtonSkeleton;

0 comments on commit c0ca44a

Please sign in to comment.