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 support for mobile tests #19

Merged
merged 1 commit into from
Jul 29, 2024
Merged
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
16 changes: 8 additions & 8 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export default defineConfig({
},

/* Test against mobile viewports. */
// {
// name: "Mobile Chrome",
// use: { ...devices["Pixel 5"] },
// },
// {
// name: "Mobile Safari",
// use: { ...devices["iPhone 12"] },
// },
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
{
name: "Mobile Safari",
use: { ...devices["iPhone 12"] },
},

/* Test against branded browsers. */
// {
Expand Down
15 changes: 7 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/app/features/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BgLayer from "@/components/layout/bg-layer";
import Container from "@/components/layout/container";
import FeatureList from "@/components/features/list";
import Header from "@/components/layout/header";
import Implementations from "@/components/features/implementations";
import MainWrapper from "@/components/layout/main-wrapper";
import { Metadata } from "next";
Expand All @@ -14,7 +13,6 @@ export const metadata: Metadata = {
export default async function FeaturesPage() {
return (
<div className="">
<Header />
<MainWrapper>
<BgLayer>
<PageHeader
Expand Down
2 changes: 0 additions & 2 deletions src/app/getting-started/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import BgLayer from "@/components/layout/bg-layer";
import Container from "@/components/layout/container";
import FaqList from "@/components/faq";
import GettingStartedList from "@/components/getting-started/list";
import Header from "@/components/layout/header";
import HostedSolutions from "@/components/hosted-solutions";
import MainWrapper from "@/components/layout/main-wrapper";
import { Metadata } from "next";
Expand All @@ -15,7 +14,6 @@ export const metadata: Metadata = {
export default function GettingStartedPage() {
return (
<div className="">
<Header />
<BgLayer>
<MainWrapper>
<PageHeader
Expand Down
2 changes: 0 additions & 2 deletions src/app/news/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BgLayer from "@/components/layout/bg-layer";
import Container from "@/components/layout/container";
import Header from "@/components/layout/header";
import MainWrapper from "@/components/layout/main-wrapper";
import { Metadata } from "next";
import NewsList from "@/components/news/list";
Expand All @@ -14,7 +13,6 @@ export const metadata: Metadata = {
export default function Homepage() {
return (
<div className="">
<Header />
<MainWrapper>
<BgLayer>
<PageHeader
Expand Down
2 changes: 0 additions & 2 deletions src/app/presentations/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BgLayer from "@/components/layout/bg-layer";
import Container from "@/components/layout/container";
import Header from "@/components/layout/header";
import MainWrapper from "@/components/layout/main-wrapper";
import { Metadata } from "next";
import PageHeader from "@/components/page-header";
Expand All @@ -14,7 +13,6 @@ export const metadata: Metadata = {
export default function PresentationsPage() {
return (
<div className="">
<Header />
<MainWrapper>
<BgLayer>
<PageHeader
Expand Down
17 changes: 13 additions & 4 deletions src/components/layout/header.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"use client";

import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";
import { Dialog, DialogPanel } from "@headlessui/react";
import React, { useEffect } from "react";

import { Dialog } from "@headlessui/react";
import Image from "next/image";
import Link from "next/link";
import React from "react";
import hykuLogo from "../../../public/logo-hyku.png";
import { usePathname } from "next/navigation";
import { useState } from "react";

export type NavItem = {
Expand Down Expand Up @@ -40,6 +41,13 @@ export const navigation: NavItem[] = [

const Header = () => {
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
const pathname = usePathname();

useEffect(() => {
if (mobileMenuOpen) {
setMobileMenuOpen(false);
}
}, [pathname]);

return (
<header className="absolute inset-x-0 top-0 z-50">
Expand Down Expand Up @@ -94,9 +102,10 @@ const Header = () => {
className="lg:hidden"
open={mobileMenuOpen}
onClose={setMobileMenuOpen}
data-testid="mobile-menu"
>
<div className="fixed inset-0 z-50" />
<Dialog.Panel className="fixed inset-y-0 right-0 z-50 w-full overflow-y-auto bg-background px-6 py-6 sm:max-w-sm sm:ring-1 sm:ring-gray-900/10">
<DialogPanel className="fixed inset-y-0 right-0 z-50 w-full overflow-y-auto bg-background px-6 py-6 sm:max-w-sm sm:ring-1 sm:ring-gray-900/10">
<div className="flex items-center justify-between">
<a href="#" className="-m-1.5 p-1.5">
<span className="sr-only">Your Company</span>
Expand Down Expand Up @@ -136,7 +145,7 @@ const Header = () => {
</div>
</div>
</div>
</Dialog.Panel>
</DialogPanel>
</Dialog>
</header>
);
Expand Down
Loading