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

Feature/desktop placeholder #88

Merged
merged 10 commits into from
Dec 16, 2024
Binary file added public/images/qr-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions src/app/DesktopPlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"use client";

import { useEffect } from "react";
import Image from "next/image";

export default function DesktopPlaceholder() {
useEffect(() => {
const mediaQuery = window.matchMedia("(min-width: 1024px)");

// Function to check if the media query matches
const checkDesktop = (e?: MediaQueryListEvent | MediaQueryList) => {
if (!e) return;
if (e.matches) {
document.body.classList.add("device-desktop-body");
} else {
document.body.classList.remove("device-desktop-body");
}
};

// Run on initial load
checkDesktop(mediaQuery);

// Add event listener for when the screen size changes
mediaQuery.addEventListener("change", checkDesktop);

// Cleanup the event listener on component unmount
return () => {
mediaQuery.removeEventListener("change", checkDesktop);
};
}, []);

return (
<>
<div className="hidden md:absolute md:block h-screen w-screen blur-sm bg-gradient-to-r from-twd-primary-purple to-purple-500 z-[99998]"></div>
<div className="hidden md:absolute md:block top-1/2 left-1/2 h-5/6 w-11/12 overflow-hidden -translate-x-1/2 -translate-y-1/2 bg-gradient-to-b from-[#1B192E] to-[#25233A] shadow-2xl border- rounded-lg z-[99999]">
<div className="text-center absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-5xl flex gap-20 flex-col w-11/12 items-center">
<h2>Thanks for visiting Things We Do</h2>
<p className="text-3xl leading-10">
At the moment, we&apos;re optimised for mobile and tablet devices.
For the best experience, please visit us on your mobile or tablet
using the QR code below.
</p>
<div className="bg-white w-72 h-72 rounded-3xl flex justify-center items-center">
<Image
src="/images/qr-code.png"
width={250}
height={250}
alt="QR code for website URL"
/>
</div>
</div>
</div>
</>
);
}
6 changes: 4 additions & 2 deletions src/app/home/components/HomeContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function HomeContent() {
<div className=" flex items-start">
<Link href="/toolkit">
<button className="bg-twd-primary-purple text-white py-2 px-4 rounded-full flex items-center gap-2">
<span className="text-base font-medium text-center">
<span className="text-base font-medium text-center text-nowrap">
Go to Toolkit
</span>
<ArrowRightIcon className="w-5 h-5" />
Expand Down Expand Up @@ -166,7 +166,9 @@ export default function HomeContent() {
transform: "translate(-50%, -50%)",
}}
>
<span className="text-base font-medium">Go to Insights</span>
<span className="text-base font-medium text-nowrap">
Go to Insights
</span>
<ArrowRightIcon className="w-5 h-5" />
</button>
</Link>
Expand Down
4 changes: 3 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { ReactNode } from "react";
import Navbar from "@/ui/layout/Navbar/Navbar";
import { DatabaseProvider } from "@/context/DatabaseContext";
import { Roboto } from "next/font/google";
import DesktopPlaceholder from "./DesktopPlaceholder";

const APP_NAME = "Things We Do";
const APP_DEFAULT_TITLE = "Things We Do";
Expand Down Expand Up @@ -60,8 +61,9 @@ export default function RootLayout({ children }: { children: ReactNode }) {
<html lang="en" dir="ltr">
<head />
<body className={`${poppins.className}`}>
<DesktopPlaceholder />
<DatabaseProvider>
<main className="pb-24">{children}</main>
<main className="pb-24 z-[60]">{children}</main>
</DatabaseProvider>
<Navbar />
</body>
Expand Down
5 changes: 5 additions & 0 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ header {
@apply bg-inherit;
}

/* Prevent scrolling when the purple div is visible */
.device-desktop-body {
overflow: hidden;
}

p {
@apply font-light;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/shared/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const Button: React.FC<ButtonProps> = ({
}
return (
<button
className={`px-4 py-2 text-sm font-bold rounded-full transition-colors duration-200 ${
className={`px-4 py-2 text-sm font-bold rounded-full transition-colors duration-200 text-nowrap ${
disabled ? "cursor-not-allowed opacity-50" : ""
} ${className}`}
onClick={disabled ? undefined : (onClick || onEventClick)}
onClick={disabled ? undefined : onClick || onEventClick}
aria-pressed={ariaPressed}
>
{label}
Expand Down
Loading