Skip to content

Commit

Permalink
refactor: removed unnecessary state use for hover effect (asyncapi#3419)
Browse files Browse the repository at this point in the history
Co-authored-by: asyncapi-bot <[email protected]>
  • Loading branch information
SahilDahekar and asyncapi-bot authored Dec 16, 2024
1 parent b7b737b commit 4f9e745
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions pages/community/tsc.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { sortBy } from 'lodash';
import React, { useState } from 'react';

import type { Tsc } from '@/types/pages/community/Community';

Expand Down Expand Up @@ -66,11 +65,9 @@ function addAdditionalUserInfo(user: Tsc) {
* @returns The Twitter SVG component.
*/
function TwitterSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
<IconTwitter className={isHovered ? 'hover:fill-black' : ''} />
<div className='size-5'>
<IconTwitter className='hover:fill-black' />
</div>
);
}
Expand All @@ -81,11 +78,9 @@ function TwitterSVG() {
* @returns The GitHub SVG component.
*/
function GitHubSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
<IconGithub className={isHovered ? 'hover:fill-black' : ''} />
<div className='size-5'>
<IconGithub className='hover:fill-black' />
</div>
);
}
Expand All @@ -96,12 +91,9 @@ function GitHubSVG() {
* @returns The LinkedIn SVG component.
*/
function LinkedInSVG() {
const [isHovered, setIsHovered] = useState(false);

return (
<div className='size-5' onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)}>
{/* Use the imported SVG icon component */}
<IconLinkedIn className={isHovered ? 'hover:fill-linkedin' : ''} />
<div className='size-5'>
<IconLinkedIn className='hover:fill-linkedin' />
</div>
);
}
Expand Down

0 comments on commit 4f9e745

Please sign in to comment.