Skip to content

Commit

Permalink
chore: Added hover effect on buttons of main page
Browse files Browse the repository at this point in the history
Added hover effect on buttons of main page
  • Loading branch information
rupali-codes authored Jul 23, 2024
2 parents 1780740 + c45b116 commit 26783f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface RatingForkProps {
iconBgColor: string
btnBgColor: string
btnTextColor: string
btnHoverColor:string
btnText: string
}

Expand Down Expand Up @@ -51,9 +52,16 @@ const RatingForkComponent: React.FC<RatingForkProps> = ({
iconBgColor,
btnBgColor,
btnTextColor,
btnHoverColor,
btnText,
}) => {
const iconStyle = { backgroundColor: iconBgColor }
const [hovered, setHovered] = useState(false)
const buttonStyle = {
backgroundColor: hovered ? btnHoverColor : btnBgColor,
color: btnTextColor,
transition: 'background-color 0.3s ease-in-out, color 0.3s ease-in-out',
}

return (
<div
Expand All @@ -78,8 +86,10 @@ const RatingForkComponent: React.FC<RatingForkProps> = ({
</div>
<Link href={link}>
<button
className={`text-base p-2 w-32 rounded-lg text-center w-full`}
style={{ backgroundColor: btnBgColor, color: btnTextColor }}
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
style={buttonStyle}
className='text-base p-2 w-32 rounded-lg text-center w-full'
>
{btnText}
</button>
Expand Down Expand Up @@ -244,6 +254,7 @@ export default function Home() {
bgColor="#575448"
iconBgColor="#FBD449"
btnBgColor="#FBD449"
btnHoverColor="#FFF455"
btnTextColor="black"
btnText="Give a star"
/>
Expand All @@ -255,6 +266,7 @@ export default function Home() {
bgColor="#403B56"
iconBgColor="#714EFF"
btnBgColor="#714EFF"
btnHoverColor="#7E8EF1"
btnTextColor="white"
btnText="Contribute now"
/>
Expand Down

0 comments on commit 26783f5

Please sign in to comment.