Skip to content

Commit

Permalink
Add hover effect to GithubStarsButton
Browse files Browse the repository at this point in the history
  • Loading branch information
vvu060 committed Dec 26, 2023
1 parent d4cb432 commit b4b702d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/shared/GithubStarsButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,16 @@ function GithubIcon() {

export default function GithubStarsButton({className}) {
const starsCount = useContext(GithubStarsContext)
const [isHovered, setIsHovered] = React.useState(false)

return (
<a href={githubRepoURL} target="_blank" className={`${className} header-button header-button-github`}>
<a
href={githubRepoURL}
onMouseOver={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
target="_blank"
className={`${className} header-button header-button-github ${isHovered && "button-grid-bg-github"}`}
>
<GithubIcon />
<span>
Star <span className="min-w-[3ch] inline-block">{starsCount}</span>
Expand Down
6 changes: 6 additions & 0 deletions src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,12 @@ nav.menu {
border-radius: 20px;
}

.button-grid-bg-github {
background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 2px),
linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 2px);
background-size: 20px 20px;
}

@media (max-width: 996px) {
.grid-bg-section {
background-size: 40px 40px;
Expand Down

0 comments on commit b4b702d

Please sign in to comment.