Skip to content

Commit 54a53ed

Browse files
authored
Merge pull request #1489 from interactivellama/moved-components
Moved components warning
2 parents f7d0ed4 + b529985 commit 54a53ed

File tree

7 files changed

+70
-0
lines changed

7 files changed

+70
-0
lines changed

components/bread-crumb/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33

44
// Alias
55
import Breadcrumb from '../breadcrumb';
6+
import componentHasMoved from '../../utilities/warning/component-has-moved';
7+
import { BREADCRUMB } from '../../utilities/constants';
8+
9+
componentHasMoved(BREADCRUMB, {
10+
oldFileLocation: 'components/bread-crumb',
11+
newFileLocation: 'components/breadcrumb',
12+
});
613

714
export default Breadcrumb;

components/forms/input/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33

44
// Alias
55
import Input from '../../input';
6+
import componentHasMoved from '../../../utilities/warning/component-has-moved';
7+
import { INPUT } from '../../../utilities/constants';
8+
9+
componentHasMoved(INPUT, {
10+
oldFileLocation: 'components/forms/input',
11+
newFileLocation: 'components/input',
12+
});
613

714
export default Input;

components/forms/radio/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33

44
// Alias
55
import Radio from '../../radio';
6+
import componentHasMoved from '../../../utilities/warning/component-has-moved';
7+
import { RADIO } from '../../../utilities/constants';
8+
9+
componentHasMoved(RADIO, {
10+
oldFileLocation: 'components/forms/radio',
11+
newFileLocation: 'components/radio',
12+
});
613

714
export default Radio;

components/forms/textarea/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33

44
// Alias
55
import TextArea from '../../textarea';
6+
import componentHasMoved from '../../../utilities/warning/component-has-moved';
7+
import { TEXTAREA } from '../../../utilities/constants';
8+
9+
componentHasMoved(TEXTAREA, {
10+
oldFileLocation: 'components/forms/textarea',
11+
newFileLocation: 'components/textarea',
12+
});
613

714
export default TextArea;

components/navigation/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@
33

44
// Alias
55
import VerticalNavigation from '../vertical-navigation';
6+
import componentHasMoved from '../../utilities/warning/component-has-moved';
7+
import { NAVIGATION } from '../../utilities/constants';
8+
9+
componentHasMoved(NAVIGATION, {
10+
oldFileLocation: 'components/navigation',
11+
newFileLocation: 'components/vertical-navigation',
12+
});
613

714
export default VerticalNavigation;

components/popover-tooltip/index.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
// Alias
55
import Tooltip from '../tooltip';
66

7+
import componentHasMoved from '../../utilities/warning/component-has-moved';
8+
import { POPOVER_TOOLTIP } from '../../utilities/constants';
9+
10+
componentHasMoved(POPOVER_TOOLTIP, {
11+
oldFileLocation: 'components/popover-tooltip',
12+
newFileLocation: 'components/tooltip',
13+
});
14+
715
export default Tooltip;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
2+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
3+
4+
/* eslint-disable import/no-mutable-exports */
5+
6+
import warning from 'warning';
7+
8+
let hasMoved = function () {};
9+
10+
if (process.env.NODE_ENV !== 'production') {
11+
const hasWarned = {};
12+
13+
hasMoved = function (control, { oldFileLocation, newFileLocation, comment }) {
14+
const additionalComment = comment ? ` ${comment}` : '';
15+
if (!hasWarned[control]) {
16+
/* eslint-disable max-len */
17+
warning(
18+
false,
19+
`[Design System React] ${control} file import path has changed. Old import path was \`design-system-react/${oldFileLocation}\`. New import path is \`design-system-react/${newFileLocation}\`.${additionalComment}`
20+
);
21+
/* eslint-enable max-len */
22+
hasWarned[control] = true;
23+
}
24+
};
25+
}
26+
27+
export default hasMoved;

0 commit comments

Comments
 (0)