Skip to content

Commit

Permalink
fix(Logo): revive href prop (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunory authored Aug 17, 2023
1 parent ca77766 commit 59b2d69
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@ export const Logo: React.FC<LogoProps> = ({
iconClassName,
iconSize = 24,
textSize = 15,
href = '/',
href,
wrapper,
onClick,
}) => {
const {compact} = useAsideHeaderContext();
const hasClickHandler = typeof onClick === 'function';
const hasWrapper = typeof wrapper === 'function';

const linkProps = hasClickHandler
? {}
: {
target: '_self',
href,
};

let buttonIcon;

if (iconSrc) {
Expand All @@ -50,7 +42,8 @@ export const Logo: React.FC<LogoProps> = ({
className={b('btn-logo')}
component={hasWrapper ? 'span' : undefined}
onClick={onClick}
{...linkProps}
target="_self"
href={href}
>
{buttonIcon}
</Button>
Expand All @@ -77,7 +70,12 @@ export const Logo: React.FC<LogoProps> = ({
(hasWrapper ? (
<div onClick={onClick}>{wrapper(logo, compact)}</div>
) : (
<a {...linkProps} className={b('logo-link')} onClick={onClick}>
<a
href={href ?? '/'}
target="_self"
className={b('logo-link')}
onClick={onClick}
>
{logo}
</a>
))}
Expand Down

0 comments on commit 59b2d69

Please sign in to comment.