Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Update onClick to onTextClick
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tran authored and Andrew Tran committed Oct 3, 2023
1 parent 8338a03 commit 744ccbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions packages/terra-clinical-header/src/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ const propTypes = {
*/
isSubheader: PropTypes.bool,

onClick: PropTypes.func,
/**
* Callback function triggered via hyperlink button title.
*/
onTextClick: PropTypes.func,
};

const defaultProps = {
Expand All @@ -82,7 +85,7 @@ const Header = ({
level,
id,
isSubheader,
onClick,
onTextClick,
...customProps
}) => {
const theme = useContext(ThemeContext);
Expand All @@ -103,8 +106,8 @@ const Header = ({
titleElement = (
<div className={cx('title-container')}>
<HeaderElement id={id} className={cx('title')}>
{onClick ? (
<HyperlinkButton onClick={onClick} text={title || text} />
{onTextClick ? (
<HyperlinkButton onClick={onTextClick} text={title || text} />
) : (
title || text
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/terra-clinical-header/tests/jest/Header.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ it('should render a header with default heading level when level not set', () =>
});

it('should render a header with hyperlink title', () => {
const header = shallowWithIntl(<Header onClick={mockFunc} text="Title" />);
const header = shallowWithIntl(<Header onTextClick={mockFunc} text="Title" />);

expect(header.find('h1').length).toEqual(1);
const hyperlinkButton = header.find('InjectIntl(Hyperlink)');
Expand Down

0 comments on commit 744ccbf

Please sign in to comment.