Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button : deprecate isSmall prop #59734

Merged
merged 7 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

- `TextControl`: Add typings for `date`, `time` and `datetime-local` ([#59666](https://github.com/WordPress/gutenberg/pull/59666)).

### Deprecation

- `isSmall` prop in `Button` component has been deprecated. Use `size="small"` prop instead ([#59734](https://github.com/WordPress/gutenberg/pull/59734)).

### Internal

- `Button`: Keep deprecated props in type definitions ([#59913](https://github.com/WordPress/gutenberg/pull/59913)).
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe( 'Button', () => {
} );

it( 'should render a button element with is-secondary and is-small class', () => {
render( <Button variant="secondary" isSmall /> );
render( <Button variant="secondary" size="small" /> );
const button = screen.getByRole( 'button' );

expect( button ).toHaveClass( 'is-secondary' );
Expand Down
16 changes: 7 additions & 9 deletions packages/components/src/button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ type BaseButtonProps = {
* Renders a pressed button style.
*/
isPressed?: boolean;
// TODO: Deprecate officially (add console warning and move to DeprecatedButtonProps).
/**
* Decreases the size of the button.
*
* Deprecated in favor of the `size` prop. If both props are defined, the `size` prop will take precedence.
*
* @deprecated Use the `'small'` value on the `size` prop instead.
*/
isSmall?: boolean;
/**
* Sets the `aria-label` of the component, if none is provided.
* Sets the Tooltip content if `showTooltip` is provided.
Expand Down Expand Up @@ -184,6 +175,13 @@ export type DeprecatedButtonProps = {
* @ignore
*/
isTertiary?: boolean;
/**
* Decreases the size of the button.
*
* @deprecated Use the `'small'` value on the `size` prop instead.
* @ignore
*/
isSmall?: boolean;
};

export type DeprecatedIconButtonProps = {
Expand Down
Loading