Skip to content

Commit

Permalink
feat(ui-shell): update depcrecation test warning
Browse files Browse the repository at this point in the history
  • Loading branch information
andreancardona committed May 18, 2021
1 parent f9b9d8c commit 8c52d94
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 40 deletions.
15 changes: 5 additions & 10 deletions packages/react/src/components/UIShell/SideNavDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ import PropTypes from 'prop-types';
import React from 'react';
import { warning } from '../../internal/warning';

let didWarnAboutDeprecation = false;

const { prefix } = settings;

const SideNavDetails = ({ children, className: customClassName, title }) => {
if (__DEV__) {
warning(
didWarnAboutDeprecation,
'The `SideNavDetails` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);
didWarnAboutDeprecation = true;
}
warning(
true,
'The `SideNavDetails` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);

const className = cx(`${prefix}--side-nav__details`, customClassName);
return (
Expand Down
15 changes: 5 additions & 10 deletions packages/react/src/components/UIShell/SideNavFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import React from 'react';
import PropTypes from 'prop-types';
import { warning } from '../../internal/warning';

let didWarnAboutDeprecation = false;

const { prefix } = settings;

/**
Expand All @@ -28,14 +26,11 @@ const SideNavFooter = ({
expanded,
onToggle,
}) => {
if (__DEV__) {
warning(
didWarnAboutDeprecation,
'The `SideNavFooter` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);
didWarnAboutDeprecation = true;
}
warning(
true,
'The `SideNavFooter` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);

const className = cx(`${prefix}--side-nav__footer`, customClassName);
return (
Expand Down
15 changes: 5 additions & 10 deletions packages/react/src/components/UIShell/SideNavHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,18 @@ import React from 'react';
import SideNavIcon from './SideNavIcon';
import { warning } from '../../internal/warning';

let didWarnAboutDeprecation = false;

const { prefix } = settings;

const SideNavHeader = ({
className: customClassName,
children,
renderIcon: IconElement,
}) => {
if (__DEV__) {
warning(
didWarnAboutDeprecation,
'The `SideNavHeader` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);
didWarnAboutDeprecation = true;
}
warning(
true,
'The `SideNavHeader` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);

const className = cx(`${prefix}--side-nav__header`, customClassName);
return (
Expand Down
15 changes: 5 additions & 10 deletions packages/react/src/components/UIShell/SideNavSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ import React from 'react';

import { warning } from '../../internal/warning';

let didWarnAboutDeprecation = false;

const { prefix } = settings;

const SideNavSwitcher = React.forwardRef(function SideNavSwitcher(props, ref) {
if (__DEV__) {
warning(
didWarnAboutDeprecation,
'The `SideNavSwitcher` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);
didWarnAboutDeprecation = true;
}
warning(
true,
'The `SideNavSwitcher` component has been deprecated and will be removed ' +
'in the next major release of `carbon-components-react`'
);

const { className: customClassName, labelText, onChange, options } = props;
const className = cx(`${prefix}--side-nav__switcher`, customClassName);
Expand Down

0 comments on commit 8c52d94

Please sign in to comment.