Skip to content

Commit ed3444d

Browse files
[Typography foundations] Temporarily remove console warnings for deprecated type components (#7808)
### WHY are these changes introduced? To mitigate the number of console warnings for the deprecated typography components, we are going to temporarily disable them in development environments until migrations in core product are complete. ### WHAT is this pull request doing? - Disables console warnings for `DisplayText`, `Heading`, `Subheading`, `Caption`, `TextStyle`, and `VisuallyHidden` <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide Co-authored-by: Aaron Casanova <[email protected]>
1 parent 2b8904f commit ed3444d

File tree

7 files changed

+5
-42
lines changed

7 files changed

+5
-42
lines changed

.changeset/friendly-geese-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': patch
3+
---
4+
5+
Temporarily removed console warnings for deprecated typography components

polaris-react/src/components/Caption/Caption.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,5 @@ export interface CaptionProps {
1515
* https://polaris.shopify.com/components/text
1616
*/
1717
export function Caption({children}: CaptionProps) {
18-
if (process.env.NODE_ENV === 'development') {
19-
// eslint-disable-next-line no-console
20-
console.warn(
21-
'Deprecation: The `Caption` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
22-
);
23-
}
24-
2518
return <p className={styles.Caption}>{children}</p>;
2619
}

polaris-react/src/components/DisplayText/DisplayText.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,5 @@ export function DisplayText({
3939
size && styles[variationName('size', size)],
4040
);
4141

42-
if (process.env.NODE_ENV === 'development') {
43-
// eslint-disable-next-line no-console
44-
console.warn(
45-
'Deprecation: The `DisplayText` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
46-
);
47-
}
48-
4942
return <Element className={className}>{children}</Element>;
5043
}

polaris-react/src/components/Heading/Heading.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ export interface HeadingProps {
2424
* https://polaris.shopify.com/components/text
2525
*/
2626
export function Heading({element: Element = 'h2', children, id}: HeadingProps) {
27-
if (process.env.NODE_ENV === 'development') {
28-
// eslint-disable-next-line no-console
29-
console.warn(
30-
'Deprecation: The `Heading` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
31-
);
32-
}
33-
3427
return (
3528
<Element className={styles.Heading} id={id}>
3629
{children}

polaris-react/src/components/Subheading/Subheading.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ export function Subheading({
2626
}: SubheadingProps) {
2727
const ariaLabel = typeof children === 'string' ? children : undefined;
2828

29-
if (process.env.NODE_ENV === 'development') {
30-
// eslint-disable-next-line no-console
31-
console.warn(
32-
'Deprecation: The `Subheading` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
33-
);
34-
}
35-
3629
return (
3730
<Element aria-label={ariaLabel} className={styles.Subheading}>
3831
{children}

polaris-react/src/components/TextStyle/TextStyle.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,6 @@ export function TextStyle({variation, children}: TextStyleProps) {
4141
variation === VariationValue.Code && styles.code,
4242
);
4343

44-
if (process.env.NODE_ENV === 'development') {
45-
// eslint-disable-next-line no-console
46-
console.warn(
47-
'Deprecation: The `TextStyle` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
48-
);
49-
}
50-
5144
const Element = variationElement(variation);
5245

5346
return <Element className={className}>{children}</Element>;

polaris-react/src/components/VisuallyHidden/VisuallyHidden.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,5 @@ export interface VisuallyHiddenProps {
1515
* https://polaris.shopify.com/components/text
1616
*/
1717
export function VisuallyHidden({children}: VisuallyHiddenProps) {
18-
if (process.env.NODE_ENV === 'development') {
19-
// eslint-disable-next-line no-console
20-
console.warn(
21-
'Deprecation: The VisuallyHidden` component has been deprecated. Use the `Text` component instead. See the Polaris component guide on how to use `Text`. https://polaris.shopify.com/components/text',
22-
);
23-
}
24-
2518
return <span className={styles.VisuallyHidden}>{children}</span>;
2619
}

0 commit comments

Comments
 (0)