Skip to content

Commit 6888e6f

Browse files
authored
add deprecation warnings to components (#1288)
1 parent 1e4a4b0 commit 6888e6f

File tree

16 files changed

+59
-36
lines changed

16 files changed

+59
-36
lines changed

.storybook/preview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const preview = {
3535
},
3636
options: {
3737
storySort: {
38+
method: 'alphabetical',
3839
order: ['Foundations', 'Components'],
3940
},
4041
},

src/CardStack/CardStack.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import CardStack from './CardStack';
77
import mdx from './CardStack.mdx';
88

99
export default {
10-
title: 'Layouts/CardStack',
10+
title: 'Components/CardStack',
1111
component: CardStack,
1212
parameters: {
1313
docs: {

src/Container/Col.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
type ColProps as ReactBootstrapColProps,
55
} from 'react-bootstrap';
66

7+
import { useDeprecationWarning } from 'src/utils';
8+
79
export type ColProps = {
810
/**
911
You can use a custom element for this component
@@ -66,6 +68,8 @@ export function Col({
6668
bsPrefix = 'col',
6769
...props
6870
}: ColProps) {
71+
useDeprecationWarning({ componentName: 'Col', message: 'Please use FlexContainer instead.' });
72+
6973
return (
7074
<ReactBootstrapCol
7175
as={as}

src/Container/Container.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import { ArgTypes, Canvas } from '@storybook/blocks';
1+
import { Canvas } from '@storybook/blocks';
22
import Container from './Container';
33
import * as ComponentStories from './Container.stories';
44

5-
# Container
5+
# Container (Deprecated)
6+
7+
<b>⚠️ Deprecated: please use <code>FlexContainer</code> instead</b>
68

79
<h4>
810
A high level grid system to help create responsive application layouts.
@@ -25,8 +27,6 @@ There are six default breakpoints, sometimes referred to as grid tiers, for buil
2527

2628
<Canvas of={ComponentStories.Default} />
2729

28-
<ArgTypes of={Container} />
29-
3030
## Stories
3131

3232
### Default

src/Container/Container.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Col, Container, Row } from '.';
55
import mdx from './Container.mdx';
66

77
export default {
8-
title: 'Layouts/Container',
8+
title: 'Deprecated/Container',
99
component: Container,
1010
parameters: {
1111
docs: {

src/Container/Container.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
type ContainerProps as ReactBootstrapContainerProps,
55
} from 'react-bootstrap';
66

7+
import { useDeprecationWarning } from 'src/utils';
8+
79
export type ContainerProps = {
810
/**
911
You can use a custom element for this component
@@ -30,6 +32,8 @@ export function Container({
3032
bsPrefix = 'container',
3133
...props
3234
}: ContainerProps) {
35+
useDeprecationWarning({ componentName: 'Container', message: 'Please use FlexContainer instead.' });
36+
3337
return (
3438
<ReactBootstrapContainer
3539
as={as}

src/Container/Row.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
type RowProps as ReactBootstrapRowProps,
55
} from 'react-bootstrap';
66

7+
import { useDeprecationWarning } from 'src/utils';
8+
79
export type RowProps = {
810
/**
911
You can use a custom element for this component
@@ -66,6 +68,8 @@ export function Row({
6668
bsPrefix = 'row',
6769
...props
6870
}: RowProps) {
71+
useDeprecationWarning({ componentName: 'Row', message: 'Please use FlexContainer instead.' });
72+
6973
return (
7074
<ReactBootstrapRow
7175
as={as}

src/Flex/Flex.mdx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { ArgTypes, Canvas } from '@storybook/blocks';
1+
import { Canvas } from '@storybook/blocks';
22
import Flex from './Flex';
33
import * as ComponentStories from './Flex.stories';
44

5-
# Flex
5+
# Flex (Deprecated)
66

7-
##
7+
<b>⚠️ Deprecated: please use <code>FlexContainer</code> instead</b>
88

99
<h4>
1010
Flex is a utility component for creating consistent spacing between items. Use this for quick alignment and spacing in your layouts.
@@ -19,21 +19,3 @@ Flexbox CSS properties in the following documentation:
1919
</ul>
2020

2121
<Canvas of={ComponentStories.Default} />
22-
23-
## Props
24-
25-
<ArgTypes of={Flex} />
26-
27-
## Stories
28-
29-
### Default
30-
31-
<Canvas of={ComponentStories.Default} />
32-
33-
### Flex Container
34-
35-
<Canvas of={ComponentStories.FlexContainer} />
36-
37-
### Flex Item
38-
39-
<Canvas of={ComponentStories.FlexItem} />

src/Flex/Flex.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import type { Meta, StoryObj } from '@storybook/react';
44
import Card from '../Card';
55
import Flex from './Flex';
66

7+
import mdx from './Flex.mdx';
8+
79
const meta: Meta<typeof Flex> = {
810
component: Flex,
911
parameters: {
1012
docs: {
11-
description: {
12-
component: 'Flex is a utility component for creating consistent spacing between items. Use this for quick alignment and spacing in your layouts.',
13-
},
13+
page: mdx,
1414
},
1515
},
16-
title: 'Layouts/Flex',
16+
title: 'Deprecated/Flex',
1717
};
1818

1919
export default meta;

src/Flex/Flex.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ReactNode, ElementType, createElement } from 'react';
22
import classNames from 'classnames';
33

4+
import { useDeprecationWarning } from 'src/utils';
5+
46
import styles from './Flex.module.scss';
57

68
export interface FlexProps {
@@ -63,6 +65,8 @@ function Flex({
6365
width,
6466
...props
6567
}: FlexProps) {
68+
useDeprecationWarning({ componentName: 'Flex', message: 'Please use FlexContainer instead.' });
69+
6670
// Defined flex properties as strings
6771
const flexClasses = [
6872
container ? styles[`flex-container`] : styles.container,

0 commit comments

Comments
 (0)