Skip to content

Commit

Permalink
added position sticky to the header and added footer
Browse files Browse the repository at this point in the history
  • Loading branch information
adhamElhabashy committed Sep 24, 2023
1 parent a8c62a8 commit 3bcce8e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTheme, responsiveFontSizes, ThemeProvider } from "@mui/material";
import Home from "./sections/Home/Home";
import Tables from "./sections/Tables/Tables";
import Graphs from "./sections/Graphs/Graphs";
import Footer from "./sections/Footer/Footer";

// edit the primary color of the theme
const theme = createTheme({
Expand All @@ -25,6 +26,7 @@ function App() {
<Home />
<Tables />
<Graphs />
<Footer />
</ThemeProvider>
);
}
Expand Down
21 changes: 21 additions & 0 deletions src/sections/Footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Box, Link } from "@mui/material";

function Footer() {
return (
<Box
sx={{
backgroundColor: "secondary.main",
padding: 1,
textAlign: "center",
}}
>
<Link
href="https://github.com/chingu-voyages/v45-tier2-team-18"
sx={{ color: "common.white", textDecoration: "none" }}
>
Github Repo
</Link>
</Box>
);
}
export default Footer;
2 changes: 1 addition & 1 deletion src/sections/Graphs/Charts/Charts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function Charts() {
{
data: Object.values(mass),
fill: false,
borderColor: "rgb(75, 192, 192)",
backgroundColor: "rgb(75, 192, 192)",
tension: 0.1,
},
],
Expand Down
9 changes: 7 additions & 2 deletions src/sections/Home/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ import { Container } from "@mui/material";

function Header() {
return (
<Box sx={{ flexGrow: 1 }}>
<AppBar position="relative" color="secondary">
<Box sx={{ flexGrow: 1, position: "sticky", top: 0, zIndex: 1000 }}>
<AppBar color="secondary">
<Container>
<Toolbar disableGutters>
<IconButton
size="large"
edge="start"
color="primary"
aria-label="menu"
onClick={() => {
document
.getElementById("landing")
.scrollIntoView({ behavior: "smooth" });
}}
>
<LanguageIcon fontSize="large" />
</IconButton>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Landing from "./Landing/Landing";

function Home() {
return (
<div className="Home">
<div className="Home" style={{ position: "relative" }}>
<Header />
<Landing />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/sections/Home/Landing/Landing.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.landing {
width: 100%;
height: calc(100vh - 64px);
height: 100vh;
background-color: #262626;
}

Expand Down
6 changes: 3 additions & 3 deletions src/sections/Home/Landing/Landing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import React from "react";
import "./Landing.css";
import Earth from "../../../assets/Ourspaceship-Africa-2k-2.png";
const Statistics = React.lazy(() => import("../Statistics/Statistics"));
import { Container, Typography, Button } from "@mui/material";
import { Container, Typography } from "@mui/material";
function Landing() {
return (
<div className="landing">
<Container className="landing-container">
<div className="landing" id="landing">
<Container className="landing-container" sx={{ padding: 10 }}>
<div className="text-box">
<Typography variant="h2" className="text-title">
Meteors and Meteorites
Expand Down

0 comments on commit 3bcce8e

Please sign in to comment.