Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: removed the unnecessary useState() hook and onMouseEnter() … #3414

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 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,10 @@ 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)}>
<div className='size-5'>
{/* Use the imported SVG icon component */}
<IconLinkedIn className={isHovered ? 'hover:fill-linkedin' : ''} />
<IconLinkedIn className='hover:fill-linkedin' />
</div>
);
}
Expand Down
Loading