Skip to content

Commit 2d6e710

Browse files
authored
Merge pull request #147 from tusharshah21/social_icon
icons added similar to the video
2 parents 8af3579 + b9d6426 commit 2d6e710

File tree

3 files changed

+96
-2
lines changed

3 files changed

+96
-2
lines changed

src/components/Footer.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React from "react";
2+
import { FaGithub, FaLinkedin } from "react-icons/fa";
3+
import { GrInstagram } from "react-icons/gr";
4+
import { FaXTwitter } from "react-icons/fa6";
5+
import { IoLogoYoutube } from "react-icons/io";
6+
import IconButton from "./IconButton";
7+
8+
function App() {
9+
const containerStyle = {
10+
display: "flex",
11+
alignItems: "center",
12+
justifyContent: "center",
13+
gap: "1rem" // equivalent to gap-4
14+
};
15+
16+
const iconStyle = { color: "white" }; // Style for white icons
17+
18+
return (
19+
<div style={containerStyle}>
20+
<a href="https://github.com/DhanushNehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}>
21+
<IconButton text="DhanushNehru">
22+
<FaGithub size={30} style={iconStyle} />
23+
</IconButton>
24+
</a>
25+
<a href="https://www.linkedin.com/in/dhanushnehru/" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}>
26+
<IconButton text="dhanushnehru" color="#316FF6">
27+
<FaLinkedin size={30} style={iconStyle} />
28+
</IconButton>
29+
</a>
30+
<a href="https://www.instagram.com/dhanush_nehru/" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}>
31+
<IconButton text="dhanush_nehru" color="#d62976">
32+
<GrInstagram size={30} style={iconStyle} />
33+
</IconButton>
34+
</a>
35+
<a href="https://x.com/Dhanush_Nehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}>
36+
<IconButton text="Dhanush_Nehru" color="black">
37+
<FaXTwitter size={30} style={iconStyle} />
38+
</IconButton>
39+
</a>
40+
<a href="https://www.youtube.com/@dhanushnehru" target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none" }}>
41+
<IconButton text="@dhanushnehru" color="#FF0000">
42+
<IoLogoYoutube size={30} style={iconStyle} />
43+
</IconButton>
44+
</a>
45+
</div>
46+
);
47+
}
48+
49+
export default App;

src/components/IconButton.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { useRef, useState } from "react"
2+
3+
export default function IconButton({ children, text, color, ...props }) {
4+
const [hovered, setHovered] = useState(false)
5+
const ref = useRef(null)
6+
7+
const buttonStyle = {
8+
display: "flex",
9+
padding: "0.5rem", // equivalent to p-2
10+
alignItems: "center",
11+
borderRadius: "0.5rem", // equivalent to rounded-lg
12+
color: "white",
13+
backgroundColor: color || "black",
14+
cursor: "pointer",
15+
border: "none",
16+
outline: "none"
17+
}
18+
19+
const textDivStyle = {
20+
overflowX: "hidden",
21+
transition: "all 0.3s ease-out",
22+
width: hovered ? ref.current?.offsetWidth || 0 : 0,
23+
}
24+
25+
const textStyle = {
26+
paddingLeft: "0.375rem", // equivalent to px-1.5
27+
paddingRight: "0.375rem",
28+
}
29+
30+
return (
31+
<button
32+
onMouseEnter={() => setHovered(true)}
33+
onMouseLeave={() => setHovered(false)}
34+
style={buttonStyle}
35+
{...props}
36+
>
37+
{children}
38+
<div style={textDivStyle}>
39+
<span ref={ref} style={textStyle}>{text}</span>
40+
</div>
41+
</button>
42+
)
43+
}

src/pages/EditorComponent.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
rapidApiKey,
2323
} from "../constants/constants";
2424
import { useAuth } from "../context/AuthContext";
25+
import Footer from "../components/Footer";
2526

2627
const StyledButton = styled(Button)({
2728
display: "flex",
@@ -276,10 +277,11 @@ function EditorComponent() {
276277
</div>
277278
</StyledLayout>
278279
<OutputLayout>
279-
{Array.isArray(output) &&
280+
{/* {Array.isArray(output) &&
280281
output.map((result, i) => {
281282
return <div key={i}>{result}</div>;
282-
})}
283+
})} */}
284+
<Footer/>
283285
</OutputLayout>
284286
</>
285287
);

0 commit comments

Comments
 (0)