Skip to content

Commit

Permalink
fix(Logo): close panels by logo click (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunory authored Feb 17, 2023
1 parent 340f9bb commit 860e8b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/components/AsideHeader/AsideHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export class AsideHeader extends React.Component<AsideHeaderInnerProps> {
);
};

private renderLogo = () => <Logo {...this.props.logo} compact={this.props.compact} />;
private renderLogo = () => (
<Logo {...this.props.logo} compact={this.props.compact} onClick={this.onLogoClick} />
);

private renderHeader = () => (
<div className={b('header')}>
Expand Down Expand Up @@ -198,4 +200,9 @@ export class AsideHeader extends React.Component<AsideHeaderInnerProps> {
this.props.onClosePanel?.();
item.onItemClick?.(item, collapsed);
};

private onLogoClick = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {
this.props.onClosePanel?.();
this.props.logo.onClick?.(event);
};
}
2 changes: 1 addition & 1 deletion src/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const Logo: React.FC<LogoInnerProps> = ({
</div>
{!compact &&
(hasWrapper ? (
wrapper(logo, compact)
<div onClick={onClick}>{wrapper(logo, compact)}</div>
) : (
<a {...linkProps} className={b('logo-link')} onClick={onClick}>
{logo}
Expand Down

0 comments on commit 860e8b2

Please sign in to comment.