Skip to content

Commit

Permalink
fix(ui-shel): fix header panel function (#2993)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandra Davila committed Jun 10, 2019
1 parent 86a499d commit 643912a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
21 changes: 10 additions & 11 deletions packages/react/src/components/UIShell/HeaderPanel.js
Expand Up @@ -13,15 +13,14 @@ import { AriaLabelPropType } from '../../prop-types/AriaPropTypes';

const { prefix } = settings;

const HeaderPanel = React.forwardRef(function HeaderPanel(props) {
const {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
children,
className: customClassName,
expanded,
} = props;

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

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

HeaderPanel.propTypes = {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/UIShell/Switcher.js
Expand Up @@ -13,7 +13,7 @@ import { AriaLabelPropType } from '../../prop-types/AriaPropTypes';

const { prefix } = settings;

const Switcher = React.forwardRef(function Switcher(props) {
const Switcher = React.forwardRef(function Switcher(props, ref) {
const {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
Expand All @@ -31,7 +31,7 @@ const Switcher = React.forwardRef(function Switcher(props) {
});

return (
<ul className={className} {...accessibilityLabel}>
<ul ref={ref} className={className} {...accessibilityLabel}>
{children}
</ul>
);
Expand Down
8 changes: 6 additions & 2 deletions packages/react/src/components/UIShell/SwitcherItem.js
Expand Up @@ -13,14 +13,18 @@ import { AriaLabelPropType } from '../../prop-types/AriaPropTypes';

const { prefix } = settings;

const SwitcherItem = React.forwardRef(function SwitcherItem(props) {
const SwitcherItem = React.forwardRef(function SwitcherItem(props, ref) {
const { className: customClassName, children } = props;

const className = cx(`${prefix}--switcher__item`, {
[customClassName]: !!customClassName,
});

return <li className={className}>{children}</li>;
return (
<li ref={ref} className={className}>
{children}
</li>
);
});

SwitcherItem.propTypes = {
Expand Down
7 changes: 5 additions & 2 deletions packages/react/src/components/UIShell/SwitcherItemLink.js
Expand Up @@ -13,7 +13,10 @@ import { AriaLabelPropType } from '../../prop-types/AriaPropTypes';

const { prefix } = settings;

const SwitcherItemLink = React.forwardRef(function SwitcherItemLink(props) {
const SwitcherItemLink = React.forwardRef(function SwitcherItemLink(
props,
ref
) {
const {
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledBy,
Expand All @@ -33,7 +36,7 @@ const SwitcherItemLink = React.forwardRef(function SwitcherItemLink(props) {
});

return (
<a className={className} {...accessibilityLabel}>
<a ref={ref} className={className} {...accessibilityLabel}>
{children}
</a>
);
Expand Down

0 comments on commit 643912a

Please sign in to comment.