Skip to content

Commit

Permalink
icons added
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharshah21 committed Oct 11, 2024
1 parent ff85e32 commit b9d6426
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
49 changes: 49 additions & 0 deletions src/components/Footer.js
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;
43 changes: 43 additions & 0 deletions src/components/IconButton.js
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>
)
}
6 changes: 4 additions & 2 deletions src/pages/EditorComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
rapidApiKey,
} from "../constants/constants";
import { useAuth } from "../context/AuthContext";
import Footer from "../components/Footer";

const StyledButton = styled(Button)({
display: "flex",
Expand Down Expand Up @@ -276,10 +277,11 @@ function EditorComponent() {
</div>
</StyledLayout>
<OutputLayout>
{Array.isArray(output) &&
{/* {Array.isArray(output) &&
output.map((result, i) => {
return <div key={i}>{result}</div>;
})}
})} */}
<Footer/>
</OutputLayout>
</>
);
Expand Down

0 comments on commit b9d6426

Please sign in to comment.