Skip to content

Commit

Permalink
Only warn when as is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Dec 26, 2024
1 parent 161b495 commit 0db5a0c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 8 additions & 6 deletions packages/components/src/navigator/navigator-back-button/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export function useNavigatorBackButton(
[ goBack, onClick ]
);

maybeWarnDeprecated36pxSize( {
componentName: 'Navigator.BackButton',
__next40pxDefaultSize: otherProps.__next40pxDefaultSize,
size: otherProps.size,
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version. For icon buttons, consider setting a non-default size like `size: "compact"`.',
} );
if ( as === undefined ) {
maybeWarnDeprecated36pxSize( {
componentName: 'Navigator.BackButton',
__next40pxDefaultSize: otherProps.__next40pxDefaultSize,
size: otherProps.size,
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version. For icon buttons, consider setting a non-default size like `size: "compact"`.',
} );
}

return {
as: as ?? Button,
Expand Down
14 changes: 8 additions & 6 deletions packages/components/src/navigator/navigator-button/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ export function useNavigatorButton(
[ goTo, onClick, attributeName, escapedPath ]
);

maybeWarnDeprecated36pxSize( {
componentName: 'Navigator.Button',
__next40pxDefaultSize: otherProps.__next40pxDefaultSize,
size: otherProps.size,
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version. For icon buttons, consider setting a non-default size like `size: "compact"`.',
} );
if ( as === undefined ) {
maybeWarnDeprecated36pxSize( {
componentName: 'Navigator.Button',
__next40pxDefaultSize: otherProps.__next40pxDefaultSize,
size: otherProps.size,
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version. For icon buttons, consider setting a non-default size like `size: "compact"`.',
} );
}

return {
as: as ?? Button,
Expand Down

0 comments on commit 0db5a0c

Please sign in to comment.