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

[OSCI] Added a console warning for panelled prop #1142

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

### Deprecations

- Added useDeprecatedPropWarning for panelled prop ([#843](https://github.com/opensearch-project/oui/pull/1142))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - use imperative for changelog entries, and link to the PR, not the issue

Suggested change
- Added useDeprecatedPropWarning for panelled prop ([#843](https://github.com/opensearch-project/oui/pull/1142))
- Add deprecation warning for `panelled` prop of `OuiPageBody` ([#1142](https://github.com/opensearch-project/oui/pull/1142))


### 🛡 Security

### 📈 Features/Enhancements
Expand Down
3 changes: 3 additions & 0 deletions src/components/page/page_body/page_body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
setPropsForRestrictedPageWidth,
} from '../_restrict_width';
import { OuiPanel, OuiPanelProps } from '../../panel';
import { useDeprecatedPropWarning } from '../../../utils/deprecated';

const paddingSizeToClassNameMap = {
none: null,
Expand All @@ -61,6 +62,7 @@ export type OuiPageBodyProps<T extends ComponentTypes = 'main'> = CommonProps &
panelled?: boolean;
/**
* Extends any extra OuiPanel props if `panelled=true`
* **panelled prop is deprecated in version 2.0.0
Copy link
Member

@joshuarrrr joshuarrrr Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is comment is on the wrong line - comments precede the props, so the comments for the panelled prop are L59-61.

*/
panelProps?: Omit<OuiPanelProps, 'paddingSize'>;
/**
Expand All @@ -86,6 +88,7 @@ export const OuiPageBody = <T extends ComponentTypes>({
style
);

useDeprecatedPropWarning({ props: { panelled }, version: '2.0.0' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also include panelProps as a deprecated prop, because it's dependent on panelled being true.

const nonBreakingDefaultPadding = panelled ? 'l' : 'none';
paddingSize = paddingSize || nonBreakingDefaultPadding;

Expand Down