From bd92ad317a42568235ed1f6efd4ab4d115ee386e Mon Sep 17 00:00:00 2001 From: Braden MacDonald Date: Fri, 17 May 2024 14:35:37 -0700 Subject: [PATCH] refactor!: remove the long-deprecated Hyperlink.content prop --- src/Hyperlink/Hyperlink.test.tsx | 14 -------------- src/Hyperlink/index.tsx | 12 +++--------- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Hyperlink/Hyperlink.test.tsx b/src/Hyperlink/Hyperlink.test.tsx index 597ba8e5c4..3982cc6fa6 100644 --- a/src/Hyperlink/Hyperlink.test.tsx +++ b/src/Hyperlink/Hyperlink.test.tsx @@ -24,20 +24,6 @@ describe('correct rendering', () => { beforeEach(() => { onClick.mockClear(); }); - it('renders with deprecated "content" prop', async () => { - // @ts-expect-error - we don't include 'content' in the types since it's deprecated. Change to 'children'. - const { getByRole } = render(); - const wrapper = getByRole('link'); - expect(wrapper).toBeInTheDocument(); - - expect(wrapper).toHaveClass('pgn__hyperlink'); - expect(wrapper).toHaveTextContent('content'); - expect(wrapper).toHaveAttribute('href', destination); - expect(wrapper).toHaveAttribute('target', '_self'); - - await userEvent.click(wrapper); - expect(onClick).toHaveBeenCalledTimes(1); - }); it('renders Hyperlink', async () => { const { getByRole } = render({content}); diff --git a/src/Hyperlink/index.tsx b/src/Hyperlink/index.tsx index efe7fd3b92..c3a807e500 100644 --- a/src/Hyperlink/index.tsx +++ b/src/Hyperlink/index.tsx @@ -5,8 +5,6 @@ import classNames from 'classnames'; import { Launch } from '../../icons'; import Icon from '../Icon'; -import withDeprecatedProps, { DeprTypes } from '../withDeprecatedProps'; - export const HYPER_LINK_EXTERNAL_LINK_ALT_TEXT = 'in a new tab'; export const HYPER_LINK_EXTERNAL_LINK_TITLE = 'Opens in a new tab'; @@ -28,6 +26,8 @@ interface Props extends Omit, 'href' | 'targ /** specify if we need to show launch Icon. By default, it will be visible. */ showLaunchIcon?: boolean; target?: '_blank' | '_self'; + /** @deprecated since Paragon v4.0.2. Use children instead. */ + content?: never; } const Hyperlink = React.forwardRef(({ @@ -130,10 +130,4 @@ Hyperlink.propTypes = { showLaunchIcon: PropTypes.bool, }; -export default withDeprecatedProps(Hyperlink, 'Hyperlink', { - /** specifies the text or element that a URL should be associated with */ - content: { - deprType: DeprTypes.MOVED, - newName: 'children', - }, -}); +export default Hyperlink;