Skip to content

Commit

Permalink
Reduce extra div
Browse files Browse the repository at this point in the history
  • Loading branch information
sadanandl committed Apr 5, 2024
1 parent e96d742 commit 3fce6c3
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

72 changes: 35 additions & 37 deletions src/logo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,47 @@ const Logo = ( { className, text, src, alt, onClick, href, extraText } ) => {
}

return (
<>
<span
className={ `stc-logo ${ className ? className : '' }${
extraText ? 'stc-extra-text' : ''
}` }
{ ...( extraText ? { 'data-extraText': extraText } : {} ) }
onClick={ ( event ) => {
if ( 'function' === typeof onClick ) {
onClick( event );
}
} }
>
{ src ? (
<>
{ href ? (
<a
href={ href }
target="_blank"
rel="noopener noreferrer"
>
<img
src={ src }
className="stc-logo-image"
alt={ alt }
/>
</a>
) : (
<span
className={ `stc-logo ${ className ? className : '' }${
extraText ? 'stc-extra-text' : ''
}` }
{ ...( extraText ? { 'data-extraText': extraText } : {} ) }
onClick={ ( event ) => {
if ( 'function' === typeof onClick ) {
onClick( event );
}
} }
>
{ src ? (
<>
{ href ? (
<a
href={ href }
target="_blank"
rel="noopener noreferrer"
>
<img
src={ src }
className="stc-logo-image"
alt={ alt }
/>
) }
</>
) : null }
</a>
) : (
<img
src={ src }
className="stc-logo-image"
alt={ alt }
/>
) }
</>
) : null }

{ text ? (
<div className="stc-logo-text" alt={ alt }>
{ text }
</div>
) : null }
</span>
</>
{ text ? (
<div className="stc-logo-text" alt={ alt }>
{ text }
</div>
) : null }
</span>
);
};

Expand Down

0 comments on commit 3fce6c3

Please sign in to comment.