Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new header #650

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo512.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>PolicyEngine</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Serif&family=Roboto:wght@300&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Serif:[email protected]&family=Roboto:wght@300;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200" />

<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
Expand Down
13 changes: 7 additions & 6 deletions src/images/logos/policyengine/profile/blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions src/images/logos/policyengine/profile/white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 32 additions & 3 deletions src/layout/Responsive.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@ import { useEffect, useMemo, useState } from "react";

const DisplaySize = {
Mobile: 0,
Tablet: 768,
Desktop: 1200,
};

const determineDisplayCategory = (width) => {
if (width < DisplaySize.Desktop) {
if (width < DisplaySize.Tablet) {
return "mobile";
} else {
return "desktop";
} else if (width < DisplaySize.Desktop) {
return "tablet";
}
return "desktop";
};

const useDisplayCategory = () => {
const [currentDisplayCategory, setcurrentDisplayCategory] = useState(
determineDisplayCategory(window.innerWidth)
);

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

return useMemo(() => currentDisplayCategory, [currentDisplayCategory]);
};

const useMobile = () => {
Expand All @@ -30,4 +47,16 @@ const useMobile = () => {
return useMemo(() => currentDisplayCategory, [currentDisplayCategory]);
};

function ResponsiveComponent(props) {
const displayCategory = useDisplayCategory();
if (displayCategory === "mobile") {
return props.mobile;
} else if (displayCategory === "tablet") {
return props.tablet;
}
return props.desktop;
}

export default useMobile;

export { useDisplayCategory, ResponsiveComponent };
2 changes: 0 additions & 2 deletions src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import SimonDuffy from "../images/headshots/simon-duffy.jpeg";
import MartinFarley from "../images/headshots/martin-farley.jpeg";
import TorrinWilkins from "../images/headshots/torrin-wilkins.webp";
import ChrisHolmes from "../images/headshots/chris-holmes.webp";

import BrianHiatt from "../images/headshots/brian-hiatt.png";
import DarrylFinkton from "../images/headshots/darryl-finkton.jpeg";
import NateGolden from "../images/headshots/nate-golden.jpg";
Expand All @@ -32,7 +31,6 @@ import UBILabs from "../images/logos/orgs/ubilabs.png";
import UKEU from "../images/logos/orgs/ukeu.svg";
import ASI from "../images/logos/orgs/asi.webp";
import CEC from "../images/logos/orgs/cec.svg";

import CGO from "../images/logos/orgs/cgo.jpg";
import EPMT from "../images/logos/orgs/epmt.jpg";
import F4GI from "../images/logos/orgs/f4gi.jpg";
Expand Down
Loading
Loading