-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff85e32
commit b9d6426
Showing
3 changed files
with
96 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react"; | ||
import { FaGithub, FaLinkedin } from "react-icons/fa"; | ||
import { GrInstagram } from "react-icons/gr"; | ||
import { FaXTwitter } from "react-icons/fa6"; | ||
import { IoLogoYoutube } from "react-icons/io"; | ||
import IconButton from "./IconButton"; | ||
|
||
function App() { | ||
const containerStyle = { | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
gap: "1rem" // equivalent to gap-4 | ||
}; | ||
|
||
const iconStyle = { color: "white" }; // Style for white icons | ||
|
||
return ( | ||
<div style={containerStyle}> | ||
<a href="https://github.com/DhanushNehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}> | ||
<IconButton text="DhanushNehru"> | ||
<FaGithub size={30} style={iconStyle} /> | ||
</IconButton> | ||
</a> | ||
<a href="https://www.linkedin.com/in/dhanushnehru/" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}> | ||
<IconButton text="dhanushnehru" color="#316FF6"> | ||
<FaLinkedin size={30} style={iconStyle} /> | ||
</IconButton> | ||
</a> | ||
<a href="https://www.instagram.com/dhanush_nehru/" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}> | ||
<IconButton text="dhanush_nehru" color="#d62976"> | ||
<GrInstagram size={30} style={iconStyle} /> | ||
</IconButton> | ||
</a> | ||
<a href="https://x.com/Dhanush_Nehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}> | ||
<IconButton text="Dhanush_Nehru" color="black"> | ||
<FaXTwitter size={30} style={iconStyle} /> | ||
</IconButton> | ||
</a> | ||
<a href="https://www.youtube.com/@dhanushnehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}> | ||
<IconButton text="@dhanushnehru" color="#FF0000"> | ||
<IoLogoYoutube size={30} style={iconStyle} /> | ||
</IconButton> | ||
</a> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { useRef, useState } from "react" | ||
|
||
export default function IconButton({ children, text, color, ...props }) { | ||
const [hovered, setHovered] = useState(false) | ||
const ref = useRef(null) | ||
|
||
const buttonStyle = { | ||
display: "flex", | ||
padding: "0.5rem", // equivalent to p-2 | ||
alignItems: "center", | ||
borderRadius: "0.5rem", // equivalent to rounded-lg | ||
color: "white", | ||
backgroundColor: color || "black", | ||
cursor: "pointer", | ||
border: "none", | ||
outline: "none" | ||
} | ||
|
||
const textDivStyle = { | ||
overflowX: "hidden", | ||
transition: "all 0.3s ease-out", | ||
width: hovered ? ref.current?.offsetWidth || 0 : 0, | ||
} | ||
|
||
const textStyle = { | ||
paddingLeft: "0.375rem", // equivalent to px-1.5 | ||
paddingRight: "0.375rem", | ||
} | ||
|
||
return ( | ||
<button | ||
onMouseEnter={() => setHovered(true)} | ||
onMouseLeave={() => setHovered(false)} | ||
style={buttonStyle} | ||
{...props} | ||
> | ||
{children} | ||
<div style={textDivStyle}> | ||
<span ref={ref} style={textStyle}>{text}</span> | ||
</div> | ||
</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters