Skip to content

Commit

Permalink
Responsive footer links for mobile view
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagansankhla committed Aug 20, 2023
1 parent 82237e5 commit 8021a8d
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions uli-website/src/components/molecules/Footer.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { Box, Nav, Text } from "grommet";
import { NavLink } from "../atoms/UliCore";
import { navigate } from "gatsby";

export default function Footer() {

const [windowWidth, setWindowWidth] = useState(window.innerWidth);

useEffect(() => {
const handleResize = () => {
setWindowWidth(window.innerWidth);
};
window.addEventListener("resize", handleResize);
return () => window.removeEventListener("resize", handleResize);
}, []);

const isSmallScreen = windowWidth <= 768;


return (
<Box align="center">
<Box
margin={{ top: "small", bottom: "small" }}
width={"large"}
direction={"row-responsive"}
gap="small"
style={
isSmallScreen
? {
flexDirection: "column",
justifyContent: "flex-start",
alignItems: "center",
}
: {}
}
>
<NavLink to="https://twitter.com/tattlemade">Twitter</NavLink>
<NavLink to="/privacy-policy">Privacy Policy</NavLink>
<NavLink to="/blog">Blog</NavLink>
<NavLink to="https://github.com/tattle-made/OGBV/tree/main/uli-website">
GitHub
</NavLink>
</Box>
<NavLink to="https://twitter.com/tattlemade">Twitter</NavLink>
<NavLink to="/privacy-policy">Privacy Policy</NavLink>
<NavLink to="/blog">Blog</NavLink>
<NavLink to="https://github.com/tattle-made/OGBV/tree/main/uli-website">
GitHub
</NavLink>
</Box>
</Box >
);
}

0 comments on commit 8021a8d

Please sign in to comment.