Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(header-panel): add refs #4738

Merged
merged 3 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions packages/react/src/components/UIShell/HeaderGlobalAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ const { prefix } = settings;
*
* Note: children passed to this component should be an Icon.
*/
const HeaderGlobalAction = ({
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
children,
className: customClassName,
onClick,
isActive,
...rest
}) => {
const HeaderGlobalAction = React.forwardRef(function HeaderGlobalAction(
{
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
children,
className: customClassName,
onClick,
isActive,
...rest
},
ref
) {
const className = cx({
[customClassName]: !!customClassName,
[`${prefix}--header__action`]: true,
Expand All @@ -45,11 +48,12 @@ const HeaderGlobalAction = ({
{...accessibilityLabel}
className={className}
onClick={onClick}
type="button">
type="button"
ref={ref}>
{children}
</button>
);
};
});

HeaderGlobalAction.propTypes = {
/**
Expand Down Expand Up @@ -80,4 +84,6 @@ HeaderGlobalAction.propTypes = {
isActive: PropTypes.bool,
};

HeaderGlobalAction.displayName = 'HeaderGlobalAction';

export default HeaderGlobalAction;
25 changes: 15 additions & 10 deletions packages/react/src/components/UIShell/HeaderPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ import { AriaLabelPropType } from '../../prop-types/AriaPropTypes';

const { prefix } = settings;

const HeaderPanel = ({
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
children,
className: customClassName,
expanded,
...other
}) => {
const HeaderPanel = React.forwardRef(function HeaderPanel(
{
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
children,
className: customClassName,
expanded,
...other
},
ref
) {
const accessibilityLabel = {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
Expand All @@ -32,11 +35,11 @@ const HeaderPanel = ({
});

return (
<div {...other} className={className} {...accessibilityLabel}>
<div {...other} className={className} {...accessibilityLabel} ref={ref}>
{children}
</div>
);
};
});

HeaderPanel.propTypes = {
/**
Expand All @@ -55,4 +58,6 @@ HeaderPanel.propTypes = {
expanded: PropTypes.bool,
};

HeaderPanel.displayName = 'HeaderPanel';

export default HeaderPanel;