Add my code

This commit is contained in:
Timur Suleymanov 2024-06-04 16:01:21 +05:00
parent 7fd9ad8a8c
commit d827e1232b
35 changed files with 1460 additions and 166 deletions

22
app/diseases/page.tsx Normal file
View File

@ -0,0 +1,22 @@
import spree from '@commerce/index';
import DiseasesAndConditions from 'components/diseases/diseases-and-conditions';
import Specialities from 'components/diseases/specialities';
import { cache } from 'react';
const getTaxons = cache(async (id: string) => {
console.log('getTaxons');
const res = await spree.taxons.list({});
if (res.isFail()) throw new Error('Failed to fetch data');
return res.success().data;
});
export default async function DiseasesPage() {
const taxons = await getTaxons();
return (
<div>
<Specialities taxons={taxons} />
<DiseasesAndConditions taxons={taxons} />
</div>
);
}

View File

@ -1,42 +1,15 @@
import Footer from 'components/layout/footer';
import Navbar from 'components/layout/navbar';
import { GeistSans } from 'geist/font/sans';
import { ensureStartsWith } from 'lib/utils';
import { ReactNode } from 'react';
import './globals.css';
const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
: 'http://localhost:3000';
const twitterCreator = TWITTER_CREATOR ? ensureStartsWith(TWITTER_CREATOR, '@') : undefined;
const twitterSite = TWITTER_SITE ? ensureStartsWith(TWITTER_SITE, 'https://') : undefined;
export const metadata = {
metadataBase: new URL(baseUrl),
title: {
default: SITE_NAME!,
template: `%s | ${SITE_NAME}`
},
robots: {
follow: true,
index: true
},
...(twitterCreator &&
twitterSite && {
twitter: {
card: 'summary_large_image',
creator: twitterCreator,
site: twitterSite
}
})
};
export default async function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en" className={GeistSans.variable}>
<body className="bg-neutral-50 text-black selection:bg-teal-300 dark:bg-neutral-900 dark:text-white dark:selection:bg-pink-500 dark:selection:text-white">
<html lang="en">
<body>
<Navbar />
<main>{children}</main>
<Footer />
</body>
</html>
);

11
app/ondemand/layout.tsx Normal file
View File

@ -0,0 +1,11 @@
import Navbar from 'components/ondemand/navbar';
import { ReactNode } from 'react';
export default function OndemandLayout({ children }: { children: ReactNode }) {
return (
<>
<Navbar />
<main>{children}</main>;
</>
);
}

3
app/ondemand/page.tsx Normal file
View File

@ -0,0 +1,3 @@
export default async function OndemandPage() {
return <h3>FUCK page</h3>;
}

View File

View File

@ -1,20 +1,17 @@
import { Carousel } from 'components/carousel';
import { ThreeItemGrid } from 'components/grid/three-items';
import Footer from 'components/layout/footer';
export const metadata = {
description: 'High-performance ecommerce store built with Next.js, Vercel, and Shopify.',
openGraph: {
type: 'website'
}
};
import ContactUs from 'components/contact-us';
import Quicklinks from 'components/home/quicklinks';
import LatestNews from 'components/latest-news';
import Hero1 from 'components/layout/hero/hero-1';
import ScienceInnovation from 'components/science-innovation';
export default async function HomePage() {
return (
<>
<ThreeItemGrid />
<Carousel />
<Footer />
<Hero1 />
<Quicklinks />
<LatestNews />
<ScienceInnovation />
<ContactUs />
</>
);
}

12
app/page/layout.tsx Normal file
View File

@ -0,0 +1,12 @@
import Footer from 'components/layout/footer';
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<>
<div className="w-full">
<div className="mx-8 max-w-2xl py-20 sm:mx-auto">{children}</div>
</div>
<Footer />
</>
);
}

View File

@ -0,0 +1,11 @@
import OpengraphImage from 'components/opengraph-image';
import { getPage } from 'lib/shopify';
export const runtime = 'edge';
export default async function Image({ params }: { params: { page: string } }) {
const page = await getPage(params.page);
const title = page.seo?.title || page.title;
return await OpengraphImage({ title });
}

45
app/page/page.tsx Normal file
View File

@ -0,0 +1,45 @@
import type { Metadata } from 'next';
import Prose from 'components/prose';
import { getPage } from 'lib/shopify';
import { notFound } from 'next/navigation';
export async function generateMetadata({
params
}: {
params: { page: string };
}): Promise<Metadata> {
const page = await getPage(params.page);
if (!page) return notFound();
return {
title: page.seo?.title || page.title,
description: page.seo?.description || page.bodySummary,
openGraph: {
publishedTime: page.createdAt,
modifiedTime: page.updatedAt,
type: 'article'
}
};
}
export default async function Page({ params }: { params: { page: string } }) {
const page = await getPage(params.page);
if (!page) return notFound();
return (
<>
<h1 className="mb-8 text-5xl font-bold">{page.title}</h1>
<Prose className="mb-8" html={page.body as string} />
<p className="text-sm italic">
{`This document was last updated on ${new Intl.DateTimeFormat(undefined, {
year: 'numeric',
month: 'long',
day: 'numeric'
}).format(new Date(page.updatedAt))}.`}
</p>
</>
);
}

10
app/tests/[id]/page.tsx Normal file
View File

@ -0,0 +1,10 @@
export default async function TestPage() {
return (
<div>
<h1>Test Detail for ID:</h1>
{/* Render test details based on the ID */}
<button>Add to cart</button>
</div>
);
}

24
app/tests/page.tsx Normal file
View File

@ -0,0 +1,24 @@
import spree from '@commerce/index';
import Alphabet from 'components/tests/alphabet';
import TestsTable from 'components/tests/tests-table';
async function getProducts() {
const res = await spree.products.list({});
if (!res.isSuccess()) {
throw new Error('Failed to fetch data');
}
return res.success().data;
}
export default async function TestsPage() {
const products = await getProducts();
return (
<div>
<Alphabet />
<TestsTable products={products} />
</div>
);
}

View File

@ -1,10 +1,9 @@
import { getCollectionProducts } from 'lib/shopify';
import Link from 'next/link';
import { GridTileImage } from './grid/tile';
export async function Carousel() {
// Collections that start with `hidden-*` are hidden from the search page.
const products = await getCollectionProducts({ collection: 'hidden-homepage-carousel' });
const products = [];
if (!products?.length) return null;

View File

@ -0,0 +1,5 @@
const ContactUs = () => {
return <div>Contact Us Block</div>;
};
export default ContactUs;

View File

@ -0,0 +1,15 @@
import Link from 'next/link';
const DiseasesAndConditions = ({ taxons = [] }) => {
return (
<ul>
{taxons.map((taxon) => (
<li key={taxon.id}>
<Link href="/">{taxon.attributes.name}</Link>
</li>
))}
</ul>
);
};
export default DiseasesAndConditions;

View File

@ -0,0 +1,15 @@
import Link from 'next/link';
const Specialities = ({ taxons = [] }) => {
return (
<ul>
{taxons.map((taxon) => (
<li key={taxon.id}>
<Link href="/">{taxon.attributes.name}</Link>
</li>
))}
</ul>
);
};
export default Specialities;

View File

@ -0,0 +1,11 @@
import Link from 'next/link';
export default function Quicklinks() {
return (
<div>
Quicklinks Block
<Link href="/tests">Test Menu</Link>
<Link href="/diseases">Diseases And Conditions</Link>
</div>
);
}

View File

@ -0,0 +1,5 @@
const LatestNews = () => {
return <div>Latest News Block</div>;
};
export default LatestNews;

View File

View File

@ -1,69 +1,69 @@
import Link from 'next/link';
import FooterMenu from 'components/layout/footer-menu';
import LogoSquare from 'components/logo-square';
import { getMenu } from 'lib/shopify';
import { Suspense } from 'react';
const Footer = () => (
<footer>
<div>
<ul>
<li>
<Link href="/about">About Us</Link>
</li>
<li>
<Link href="/newsroom">Newsroom</Link>
</li>
<li>
<Link href="/careers">Careers</Link>
</li>
<li>
<Link href="/investors">Investors</Link>
</li>
</ul>
<ul>
<li>
<Link href="/lab">Labs</Link>
</li>
<li>
<Link href="/test-results">Test Results</Link>
</li>
<li>
<Link href="/all-patient">All Patient</Link>
</li>
<li>
<Link href="/all-provider">All Provider</Link>
</li>
</ul>
<ul>
<li>
<Link href="/suppliers">Suppliers & Vendors</Link>
</li>
<li>
<Link href="/hsnpa">HSNPA Notice</Link>
</li>
<li>
<Link href="/privacy-practices">Privacy Practices</Link>
</li>
<li>
<Link href="/no-surprises">No Surprises Act</Link>
</li>
</ul>
<ul>
<li>
<Link href="/biopharma">Biopharma</Link>
</li>
<li>
<Link href="/drug-testing">Drug Testing</Link>
</li>
<li>
<Link href="/paternity-testing">Paternity Testing</Link>
</li>
<li>
<Link href="/health-testing">Health Testing</Link>
</li>
</ul>
</div>
<div>
<p>&copy; 2024 Labcorp</p>
</div>
</footer>
);
const { COMPANY_NAME, SITE_NAME } = process.env;
export default async function Footer() {
const currentYear = new Date().getFullYear();
const copyrightDate = 2023 + (currentYear > 2023 ? `-${currentYear}` : '');
const skeleton = 'w-full h-6 animate-pulse rounded bg-neutral-200 dark:bg-neutral-700';
const menu = await getMenu('next-js-frontend-footer-menu');
const copyrightName = COMPANY_NAME || SITE_NAME || '';
return (
<footer className="text-sm text-neutral-500 dark:text-neutral-400">
<div className="mx-auto flex w-full max-w-7xl flex-col gap-6 border-t border-neutral-200 px-6 py-12 text-sm md:flex-row md:gap-12 md:px-4 min-[1320px]:px-0 dark:border-neutral-700">
<div>
<Link className="flex items-center gap-2 text-black md:pt-1 dark:text-white" href="/">
<LogoSquare size="sm" />
<span className="uppercase">{SITE_NAME}</span>
</Link>
</div>
<Suspense
fallback={
<div className="flex h-[188px] w-[200px] flex-col gap-2">
<div className={skeleton} />
<div className={skeleton} />
<div className={skeleton} />
<div className={skeleton} />
<div className={skeleton} />
<div className={skeleton} />
</div>
}
>
<FooterMenu menu={menu} />
</Suspense>
<div className="md:ml-auto">
<a
className="flex h-8 w-max flex-none items-center justify-center rounded-md border border-neutral-200 bg-white text-xs text-black dark:border-neutral-700 dark:bg-black dark:text-white"
aria-label="Deploy on Vercel"
href="https://vercel.com/templates/next.js/nextjs-commerce"
>
<span className="px-3"></span>
<hr className="h-full border-r border-neutral-200 dark:border-neutral-700" />
<span className="px-3">Deploy</span>
</a>
</div>
</div>
<div className="border-t border-neutral-200 py-6 text-sm dark:border-neutral-700">
<div className="mx-auto flex w-full max-w-7xl flex-col items-center gap-1 px-4 md:flex-row md:gap-0 md:px-4 min-[1320px]:px-0">
<p>
&copy; {copyrightDate} {copyrightName}
{copyrightName.length && !copyrightName.endsWith('.') ? '.' : ''} All rights reserved.
</p>
<hr className="mx-4 hidden h-4 w-[1px] border-l border-neutral-400 md:inline-block" />
<p>Designed in California</p>
<p className="md:ml-auto">
<a href="https://vercel.com" className="text-black dark:text-white">
Crafted by Vercel
</a>
</p>
</div>
</div>
</footer>
);
}
export default Footer;

View File

@ -0,0 +1,13 @@
const { COMPANY_NAME, SITE_NAME } = process.env;
import Navbar from 'components/layout/navbar';
import Topbar from 'components/layout/topbar';
export default function Header() {
return (
<header className="responsivegrid aem-GridColumn aem-GridColumn--default--12 container">
<Topbar />
<Navbar />
</header>
);
}

View File

@ -0,0 +1,5 @@
const Hero1 = () => {
return <div>Hero 1 Block</div>;
};
export default Hero1;

View File

@ -0,0 +1,5 @@
const Hero2 = () => {
return <div>Hero 2 Block</div>;
};
export default Hero2;

View File

@ -1,58 +1,13 @@
import Cart from 'components/cart';
import OpenCart from 'components/cart/open-cart';
import LogoSquare from 'components/logo-square';
import { getMenu } from 'lib/shopify';
import { Menu } from 'lib/shopify/types';
import Link from 'next/link';
import { Suspense } from 'react';
import MobileMenu from './mobile-menu';
import Search, { SearchSkeleton } from './search';
const { SITE_NAME } = process.env;
export default async function Navbar() {
const menu = await getMenu('next-js-frontend-header-menu');
export default function Navbar() {
return (
<nav className="relative flex items-center justify-between p-4 lg:px-6">
<div className="block flex-none md:hidden">
<Suspense fallback={null}>
<MobileMenu menu={menu} />
</Suspense>
</div>
<div className="flex w-full items-center">
<div className="flex w-full md:w-1/3">
<Link href="/" className="mr-2 flex w-full items-center justify-center md:w-auto lg:mr-6">
<LogoSquare />
<div className="ml-2 flex-none text-sm font-medium uppercase md:hidden lg:block">
{SITE_NAME}
</div>
</Link>
{menu.length ? (
<ul className="hidden gap-6 text-sm md:flex md:items-center">
{menu.map((item: Menu) => (
<li key={item.title}>
<Link
href={item.path}
className="text-neutral-500 underline-offset-4 hover:text-black hover:underline dark:text-neutral-400 dark:hover:text-neutral-300"
>
{item.title}
</Link>
</li>
))}
</ul>
) : null}
</div>
<div className="hidden justify-center md:flex md:w-1/3">
<Suspense fallback={<SearchSkeleton />}>
<Search />
</Suspense>
</div>
<div className="flex justify-end md:w-1/3">
<Suspense fallback={<OpenCart />}>
<Cart />
</Suspense>
</div>
</div>
<nav>
<Link href="/">Home</Link>
<Link href="/about">About</Link>
<Link href="/news">News</Link>
<Link href="/careers">Careers</Link>
<Link href="/help">Help</Link>
</nav>
);
}

View File

@ -0,0 +1,956 @@
export default function Topbar() {
return (
<div className="responsivegrid container">
<div id="container-1f99be38e4" className="cmp-container">
<div className="responsivegrid contained global-topnav-menu padding-top-bottom-16 container">
<div id="container-2af0118eb1" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--tablet--7 aem-Grid--default--12 ">
<div className="globalnavigation aem-GridColumn--tablet--1 aem-GridColumn--default--none aem-GridColumn aem-GridColumn--offset--default--0 aem-GridColumn--default--1">
<button
id="globalnavigation-hamburger"
className="globalnavigation-toggle"
aria-controls="globalnavigation-menu"
aria-expanded="false"
aria-label="Open global Navigation"
></button>
<div className="globalnavigation-navModal" id="globalnavigation-menu">
<div className="close-btn">
<button
id="globalnavigation-closemodal"
aria-controls="globalnavigation-menu"
aria-label="Close global Navigation"
></button>
</div>
<div className="xfpageext xfpage page basicpage">
<div className="xf-content-height">
<div className="root responsivegrid container">
<div id="container-3afad37a75" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<nav className="responsivegrid aem-GridColumn aem-GridColumn--default--12 container">
<div id="container-77eb8fa08d" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="responsivegrid aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--12 aem-GridColumn--offset--default--0 container bg-white">
<div id="container-3c8442d54d" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="image aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--5 aem-GridColumn--offset--default--0">
<div className="cmp-image">
<a
className="cmp-image__link"
tabIndex={-1}
href="https://www.labcorp.com/"
aria-label="Labcorp Logo"
>
<img
src="https://www.labcorp.com/content/dam/labcorp/images/2023/12/labcorp-logo.png"
loading="lazy"
className="cmp-image__image"
tabIndex={0}
itemProp="contentUrl"
width={200}
height={53}
alt="Labcorp"
/>
</a>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid bg-gray-7 aem-GridColumn aem-GridColumn--default--12 container">
<div id="container-5d6ca48035" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="button globalnav-btn aem-GridColumn aem-GridColumn--default--12">
<div className="user-icon">
<div>
<a
id="button-b3d4bc0d4e"
className="cmp-button"
href="https://www.labcorp.com/logins"
>
<span
className="cmp-button__icon cmp-button__icon--user-icon"
aria-hidden="true"
/>
<span className="cmp-button__text">Logins</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid bg-gray-7 aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--12 aem-GridColumn--offset--default--0 container">
<div id="container-8fc48ba12b" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="experiencefragment aem-GridColumn aem-GridColumn--default--12">
<div
id="experiencefragment-25c77b4a39"
className="cmp-experiencefragment cmp-experiencefragment--top-nav-quick-links"
>
<div
id="container-c53f00e4dd"
className="cmp-container"
>
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="responsivegrid aem-GridColumn aem-GridColumn--default--12 container">
<div
id="container-97e567dae1"
className="cmp-container"
>
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="topnavquicklinks aem-GridColumn aem-GridColumn--default--12">
<div className="tab-container">
{/* Tab 1 */}
<button
id="tabset1-1-9ea9c975-c40c-44bc-88f4-64061a562a9f"
role="tab"
aria-selected="true"
aria-controls="panel1-9ea9c975-c40c-44bc-88f4-64061a562a9f"
className="button-tab"
>
Individuals &amp; Patients
</button>
<div
className="panel-tab "
id="panel1-9ea9c975-c40c-44bc-88f4-64061a562a9f"
role="tabpanel"
aria-labelledby="tabset1-1-9ea9c975-c40c-44bc-88f4-64061a562a9f"
aria-hidden="false"
>
<div>
<div className="tab_content-button">
<a
href="https://www.labcorp.com/labs-and-appointments-advanced-search"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--location-icon" />
<span className="tab-text">
Find a Lab
</span>
</a>
<a
href="https://www.labcorp.com/patients/results"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--casestudy-icon" />
<span className="tab-text">
View Test Results
</span>
</a>
<a
href="https://patient.labcorp.com/invoices/find"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--patientbill-icon" />
<span className="tab-text">
Pay a Bill{' '}
</span>
</a>
<a
href="https://www.ondemand.labcorp.com/products"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--retail-icon" />
<span className="tab-text">
Shop for Tests{' '}
</span>
</a>
</div>
</div>
<a
href="https://www.labcorp.com/patients"
className="tab-link"
target="_self"
>
<span className="tab-text">
View Individuals &amp; Patients Page{' '}
</span>
</a>
</div>
{/* Tab 2 */}
<button
id="tabset1-2-0fd86cae-38ad-41c7-b0d2-e983b532447f"
role="tab"
aria-controls="panel2-0fd86cae-38ad-41c7-b0d2-e983b532447f"
className="button-tab"
>
Providers
</button>
<div
className="panel-tab"
id="panel2-0fd86cae-38ad-41c7-b0d2-e983b532447f"
role="tabpanel"
aria-labelledby="tabset1-2-0fd86cae-38ad-41c7-b0d2-e983b532447f"
>
<div>
<div className="tab_content-button">
<a
href="https://www.labcorp.com/test-menu/search"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--container-icon" />
<span className="tab-text">
Test Menu
</span>
</a>
<a
href="https://www.labcorplink.com/ui/#/login"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--patients-icon" />
<span className="tab-text">
Provider Login
</span>
</a>
<a
href="https://www.labcorp.com/science"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--patientresources-icon" />
<span className="tab-text">
Education &amp; Experts
</span>
</a>
<a
href="https://www.labcorp.com/contact-labcorp-account-representative"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--communicate-icon" />
<span className="tab-text">
Contact Us
</span>
</a>
</div>
</div>
<a
href="https://www.labcorp.com/providers"
className="tab-link"
target="_self"
>
<span className="tab-text">
View Providers Page
</span>
</a>
</div>
{/* Tab 3 */}
<button
id="tabset1-3-0ae4906c-8cba-48bc-b0f1-65db9ab26912"
role="tab"
aria-controls="panel3-0ae4906c-8cba-48bc-b0f1-65db9ab26912"
className="button-tab"
>
Health Systems &amp; Organizations
</button>
<div
className="panel-tab"
id="panel3-0ae4906c-8cba-48bc-b0f1-65db9ab26912"
role="tabpanel"
aria-labelledby="tabset1-3-0ae4906c-8cba-48bc-b0f1-65db9ab26912"
>
<div>
<div className="tab_content-button">
<a
href="https://www.labcorp.com/organizations/hospitals"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--hospitalhealthsystems-icon" />
<span className="tab-text">
Hospitals &amp; Health Systems
</span>
</a>
<a
href="https://www.labcorp.com/organizations/employers"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--employeewellness-icon" />
<span className="tab-text">
Employee Wellness &amp; Testing
</span>
</a>
<a
href="https://www.labcorp.com/organizations/managed-care"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--managedcare-icon" />
<span className="tab-text">
Managed Care &amp; Payors
</span>
</a>
<a
href="https://www.labcorp.com/organizations/resources"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--casestudy-icon" />
<span className="tab-text">
Resources
</span>
</a>
</div>
</div>
<a
href="https://www.labcorp.com/organizations"
className="tab-link"
target="_self"
>
<span className="tab-text">
View Organizations Page
</span>
</a>
</div>
{/* Tab 4 */}
<button
id="tabset1-4-29750eab-a3ec-4870-87b1-085d39098005"
role="tab"
aria-controls="panel4-29750eab-a3ec-4870-87b1-085d39098005"
className="button-tab"
>
Biopharma
</button>
<div
className="panel-tab"
id="panel4-29750eab-a3ec-4870-87b1-085d39098005"
role="tabpanel"
aria-labelledby="tabset1-4-29750eab-a3ec-4870-87b1-085d39098005"
>
<div>
<div className="tab_content-button">
<a
href="https://www.labcorp.com/biopharma/nonclinical-research-studies"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--datasets-icon" />
<span className="tab-text">
Nonclinical Research
</span>
</a>
<a
href="https://www.labcorp.com/biopharma/clinical-trial-testing-labs"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--development-icon" />
<span className="tab-text">
Central Laboratory Services
</span>
</a>
<a
href="https://biopharma.labcorp.com/clinical-testing/labs-kits/investigators/order-a-kit.html"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--retail-icon" />
<span className="tab-text">
Order a Kit
</span>
</a>
<a
href="https://biopharma.labcorp.com/contact-us.html"
className="tab-link-button"
target="_self"
>
<span className="cmp-button__icon cmp-button__icon--communicate-icon" />
<span className="tab-text">
Contact Us
</span>
</a>
</div>
</div>
<a
href="https://www.labcorp.com/biopharma"
className="tab-link"
target="_self"
>
<span className="tab-text">
View Biopharma Page
</span>
</a>
</div>
{/* Tab 5 */}
{/* Tab 6 */}
</div>
</div>
</div>
</div>
</div>
<nav className="responsivegrid aem-GridColumn aem-GridColumn--default--12 container">
<div
id="container-620ef24c7a"
className="cmp-container"
></div>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid bg-gray-7 aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--12 aem-GridColumn--offset--default--0 container">
<div id="container-71e63cf21d" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="list navStyle lastItemCaret aem-GridColumn aem-GridColumn--default--12">
<h2>
<a
href="https://www.labcorp.com/wellness"
target="_self"
>
Managing Your Health
</a>
</h2>
<ul id="list-ad78bd18cf" className="cmp-list">
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.ondemand.labcorp.com/products"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Shop for Health Tests
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://womenshealth.labcorp.com/"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Explore Women's Health
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/patients/health-screenings"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Annual Wellness Guidelines{' '}
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/wellness"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">More</span>
</a>
</li>
</ul>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--12">
<div id="separator-3b791ec7bb" className="cmp-separator">
<hr
className="cmp-separator__horizontal-rule"
aria-hidden="true"
role="none"
/>
</div>
</div>
<div className="list navStyle lastItemCaret aem-GridColumn aem-GridColumn--default--12">
<h2>
<a
href="https://www.labcorp.com/diseases"
target="_self"
>
Diseases &amp; Specialties
</a>
</h2>
<ul id="list-ee659b5733" className="cmp-list">
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://oncology.labcorp.com"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Cancer &amp; Oncology
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/providers/neurology"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Neurology
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/providers/rheumatology"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Rheumatology
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/diseases"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">More</span>
</a>
</li>
</ul>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--12">
<div id="separator-fa749afb76" className="cmp-separator">
<hr
className="cmp-separator__horizontal-rule"
aria-hidden="true"
role="none"
/>
</div>
</div>
<div className="list navStyle lastItemCaret aem-GridColumn aem-GridColumn--default--12">
<h2>
<a
href="https://www.labcorp.com/modalities"
target="_self"
>
Treatment Methods &amp; Product Testing
</a>
</h2>
<ul id="list-4d5e01f122" className="cmp-list">
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://biopharma.labcorp.com/clinical-testing/precision-medicine-solutions/cell-and-gene-therapy.html"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Cell &amp; Gene Therapies
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://biopharma.labcorp.com/clinical-testing/precision-medicine-solutions.html"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Precision Medicine{' '}
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://biopharma.labcorp.com/industry-solutions/by-product/vaccines.html"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Vaccines
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/modalities"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">More</span>
</a>
</li>
</ul>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--12">
<div id="separator-f91e9dd05c" className="cmp-separator">
<hr
className="cmp-separator__horizontal-rule"
aria-hidden="true"
role="none"
/>
</div>
</div>
<div className="list navStyle lastItemCaret aem-GridColumn aem-GridColumn--default--12">
<h2>
<a
href="https://www.labcorp.com/disciplines"
target="_self"
>
Lab Disciplines &amp; Services
</a>
</h2>
<ul id="list-9058237192" className="cmp-list">
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/genetics-genomics"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Genetics &amp; Genomics
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://biopharma.labcorp.com/services/pathology.html"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Pathology
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://biopharma.labcorp.com/services/safety-assessment.html"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">
Toxicology
</span>
</a>
</li>
<li className="cmp-list__item">
<a
className="cmp-list__item-link"
href="https://www.labcorp.com/disciplines"
target="_self"
data-cmp-clickable="true"
>
<span className="cmp-list__item-title">More</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div className="responsivegrid border-right border-gray aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--6 aem-GridColumn--offset--default--0 container bg-white">
<div id="container-af7d1e843a" className="cmp-container">
<div className="aem-Grid aem-Grid--6 aem-Grid--default--6 ">
<div className="button globalnav-btn aem-GridColumn aem-GridColumn--default--6">
<div className="cost-estimate-icon">
<div>
<a
id="button-d73f91fd8c"
className="cmp-button"
href="https://www.labcorp.com/providers/specialists"
aria-label="Reference & Specialty Labs"
>
<span
className="cmp-button__icon cmp-button__icon--cost-estimate-icon"
aria-hidden="true"
/>
<span className="cmp-button__text">
Reference &amp; Specialty Labs
</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--6 aem-GridColumn--offset--default--0 container bg-white">
<div id="container-42f33d8085" className="cmp-container">
<div className="aem-Grid aem-Grid--6 aem-Grid--default--6 ">
<div className="button globalnav-btn aem-GridColumn aem-GridColumn--default--6">
<div className="research-icon">
<div>
<a
id="button-b282156913"
className="cmp-button"
href="https://biopharma.labcorp.com/"
aria-label="Research & Development Labs"
>
<span
className="cmp-button__icon cmp-button__icon--research-icon"
aria-hidden="true"
/>
<span className="cmp-button__text">
Research &amp; Development Labs
</span>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid bg-navy aem-GridColumn aem-GridColumn--default--12 container">
<div id="container-c3ead77c7b" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 ">
<div className="responsivegrid aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--10 aem-GridColumn--offset--default--1 container">
<div id="container-67acfdf659" className="cmp-container">
<div className="aem-Grid aem-Grid--10 aem-Grid--default--10 ">
<div className="text body1 aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--10 aem-GridColumn--offset--default--0 text-white">
<div id="text-7c83405c7d" className="cmp-text">
<p>
<a
href="https://www.labcorp.com/about"
aria-label="About"
>
About us
</a>
</p>
</div>
</div>
<div className="separator aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--10 aem-GridColumn--offset--default--0">
<div
id="separator-abc7a2aea6"
className="cmp-separator"
>
<hr className="cmp-separator__horizontal-rule" />
</div>
</div>
<div className="text body1 aem-GridColumn aem-GridColumn--default--10 text-white">
<div id="text-2d0e74e47f" className="cmp-text">
<p>
<a
href="https://www.labcorp.com/newsroom"
aria-label="News"
>
News
</a>
</p>
</div>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--10">
<div
id="separator-01f3293014"
className="cmp-separator"
>
<hr className="cmp-separator__horizontal-rule" />
</div>
</div>
<div className="text body1 aem-GridColumn aem-GridColumn--default--10 text-white">
<div id="text-cf0d378afb" className="cmp-text">
<p>
<a
href="https://careers.labcorp.com/global/en"
target="_blank"
rel="noopener noreferrer"
aria-label="Careers"
>
Careers
</a>
</p>
</div>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--10">
<div
id="separator-9ce22eb846"
className="cmp-separator"
>
<hr className="cmp-separator__horizontal-rule" />
</div>
</div>
<div className="text body1 aem-GridColumn aem-GridColumn--default--10 text-white">
<div id="text-0eca6e7765" className="cmp-text">
<p>
<a
href="https://ir.labcorp.com/"
target="_blank"
rel="noopener noreferrer"
aria-label="investors"
>
Investors
</a>
</p>
</div>
</div>
<div className="separator aem-GridColumn aem-GridColumn--default--10">
<div
id="separator-fa8cb396ff"
className="cmp-separator"
>
<hr className="cmp-separator__horizontal-rule" />
</div>
</div>
<div className="text body1 aem-GridColumn aem-GridColumn--default--10 text-white">
<div id="text-84ea2bbe5d" className="cmp-text">
<p>
<a
href="https://www.labcorp.com/contact-us"
aria-label="Help"
>
Help
</a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="responsivegrid aem-GridColumn aem-GridColumn--default--12 container">
<div id="container-9faf004657" className="cmp-container">
<div className="aem-Grid aem-Grid--12 aem-Grid--default--12 "></div>
</div>
</div>
</div>
</div>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="image aem-GridColumn--default--none aem-GridColumn aem-GridColumn--tablet--2 aem-GridColumn--offset--default--0 aem-GridColumn--default--2">
<div className="cmp-image" itemType="http://schema.org/ImageObject">
<a className="cmp-image__link" tabIndex={-1} href="/" aria-label="Labcorp Logo">
<img
src="https://www.labcorp.com/content/dam/labcorp/images/2023/12/labcorp-logo@2x.png"
loading="lazy"
className="cmp-image__image"
tabIndex={0}
itemProp="contentUrl"
width={399}
height={106}
alt="Labcorp"
/>
</a>
</div>
</div>
<div className="responsivegrid aem-GridColumn--default--none aem-GridColumn aem-GridColumn--default--8 aem-GridColumn--tablet--7 aem-GridColumn--offset--default--1 container">
<div id="container-09ff0e5b1d" className="cmp-container">
<div className="text text-navy body2">
<div id="text-2d356dd3ac" className="cmp-text">
<p>
<a href="/about">About</a>
</p>
</div>
</div>
<div className="text text-navy body2">
<div id="text-6a5002cdbc" className="cmp-text">
<p>
<a href="/newsroom" target="_self" rel="noopener noreferrer">
News
</a>
</p>
</div>
</div>
<div className="text text-navy body2">
<div id="text-a63751913f" className="cmp-text">
<p>
<a
href="https://careers.labcorp.com/global/en"
target="_self"
rel="noopener noreferrer"
>
Careers
</a>
</p>
</div>
</div>
<div className="separator">
<div id="verticle-sepratore" className="cmp-separator">
<hr className="cmp-separator__horizontal-rule" />
</div>
</div>
<div className="search">
<div className="endpointurl" data-url="https://www.labcorp.com" />
<div className="input-box">
<input
type="text"
id="search-area"
aria-label="search"
placeholder="search"
aria-hidden="true"
/>
<div className="search">
<button
type="button"
className="search-icon"
aria-expanded="false"
aria-label="Search"
aria-controls="search-area"
/>
</div>
<span
className="close-icon"
role="button"
aria-label="search-close-button"
aria-hidden="true"
/>
</div>
</div>
<div className="text text-navy body2">
<div id="text-1cd6cb03e5" className="cmp-text">
<p>
<a href="https://www.labcorp.com/contact-us">Help</a>
</p>
</div>
</div>
<div className="text text-navy body2">
<div id="text-ab96ea9d81" className="cmp-text">
<p>
<a href="https://www.labcorp.com/logins">Login</a>
</p>
</div>
</div>
<div className="iconlisting">
<div className="icon">
<ul>
<li className="icon-accessibility">
<a
aria-label="Level Access website accessibility icon."
href="https://www.essentialaccessibility.com/labcorp/?utm_source=labcorphomepage&utm_medium=iconlarge&utm_term=eachannelpage&utm_content=header&utm_campaign=labcorp"
>
<img alt="Level Access website accessibility icon." loading="lazy" />
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}

View File

@ -0,0 +1,93 @@
import Image from 'next/image';
const NavBar = () => {
return (
<nav className="navbar">
<div className="navbar__logo">
<a href="/content/labcorp-ondemand/us/en">
<Image
src="https://via.placeholder.com/150x50?text=Labcorp+Logo"
alt="Labcorp Logo"
width={150}
height={50}
/>
</a>
</div>
<div className="navbar__links">
<a href="/content/labcorp-ondemand/us/en/products" className="navbar__link">
Shop Tests
</a>
<a href="/kit/register/code" className="navbar__link">
Register Kit
</a>
<a
href="https://patient.labcorp.com/portal/results/list"
target="_blank"
className="navbar__link"
>
View Results
</a>
<a href="/content/labcorp-ondemand/us/en/about-us" className="navbar__link">
About
</a>
</div>
<div className="navbar__auth">
<span className="navbar__signin">
<a href="https://login-patient.labcorp.com/oauth2/default/v1/authorize?...">Sign In</a>
</span>
<button className="navbar__signout">Sign Out</button>
</div>
<div className="navbar__search">
<button className="search-toggle" title="Search">
<Image
src="https://via.placeholder.com/28?text=Search+Icon"
alt="Search"
width={28}
height={28}
/>
</button>
</div>
<div className="navbar__cart">
<a href="/checkout/cart/">
<Image
src="https://via.placeholder.com/28?text=Cart+Items+Icon"
alt="Cart Items"
width={28}
height={28}
className="cart-icon"
/>
<Image
src="https://via.placeholder.com/28?text=Empty+Cart+Icon"
alt="Empty Cart"
width={28}
height={28}
className="empty-cart-icon"
/>
</a>
</div>
<div className="navbar__burger">
<button>
<Image
src="https://via.placeholder.com/20?text=Menu+Icon"
alt="Menu"
width={20}
height={20}
/>
<Image
src="https://via.placeholder.com/20?text=Close+Icon"
alt="Close"
width={20}
height={20}
/>
</button>
</div>
</nav>
);
};
export default NavBar;

View File

@ -0,0 +1,5 @@
const ScienceInnovation = () => {
return <div>Sience Innovation Block</div>;
};
export default ScienceInnovation;

View File

@ -0,0 +1,3 @@
export default function Alphabet() {
return <nav className="responsivegrid container">Alphabet</nav>;
}

View File

@ -0,0 +1,15 @@
'use client';
interface Props {
id: number;
}
const CartButton: React.FC<Props> = ({ id }) => {
const handleClick = () => {
console.log('click', id);
};
return <button onClick={handleClick}>Add To Cart 1</button>;
};
export default CartButton;

View File

@ -0,0 +1,31 @@
import Link from 'next/link';
import CartButton from './cart-button';
export default function TestsTable({ products = [] }) {
return (
<div>
<table>
<thead>
<tr>
<th>Number</th>
<th>Name</th>
<th>Specimen</th>
</tr>
</thead>
<tbody>
{products.map((product) => (
<tr key={product.id}>
<td>{product.id}</td>
<td>
<Link href={`/tests/${product.id}`}>{product.attributes.name}</Link>
</td>
<td>
<CartButton id={product.id} />
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}

0
lib/spree/api.ts Normal file
View File

9
lib/spree/index.ts Normal file
View File

@ -0,0 +1,9 @@
const createAxiosFetcher = require('@spree/axios-fetcher/dist/server/index').default;
import { makeClient } from '@spree/storefront-api-v2-sdk/dist/client';
const spree = makeClient({
host: 'http://localhost:3000',
createFetcher: createAxiosFetcher
});
export default spree;

35
lib/spree/provider.ts Normal file
View File

@ -0,0 +1,35 @@
import fetcher from './fetcher';
import { handler as useCart } from './cart/use-cart';
import { handler as useAddItem } from './cart/use-add-item';
import { handler as useUpdateItem } from './cart/use-update-item';
import { handler as useRemoveItem } from './cart/use-remove-item';
import { handler as useCustomer } from './customer/use-customer';
import { handler as useSearch } from './product/use-search';
import { handler as useLogin } from './auth/use-login';
import { handler as useLogout } from './auth/use-logout';
import { handler as useSignup } from './auth/use-signup';
import { handler as useCheckout } from './checkout/use-checkout';
import { handler as useWishlist } from './wishlist/use-wishlist';
import { handler as useWishlistAddItem } from './wishlist/use-add-item';
import { handler as useWishlistRemoveItem } from './wishlist/use-remove-item';
import { requireConfigValue } from './isomorphic-config';
const spreeProvider = {
locale: requireConfigValue('defaultLocale') as string,
cartCookie: requireConfigValue('cartCookieName') as string,
fetcher,
cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },
customer: { useCustomer },
products: { useSearch },
auth: { useLogin, useLogout, useSignup },
checkout: { useCheckout },
wishlist: {
useWishlist,
useAddItem: useWishlistAddItem,
useRemoveItem: useWishlistRemoveItem
}
};
export { spreeProvider };
export type SpreeProvider = typeof spreeProvider;

View File

@ -1,5 +1,5 @@
/** @type {import('next').NextConfig} */
module.exports = {
const baseConfig = {
eslint: {
// Disabling on production builds because we're running checks on PRs via GitHub Actions.
ignoreDuringBuilds: true
@ -24,3 +24,7 @@ module.exports = {
];
}
};
const spreeConfig = {};
module.exports = { ...baseConfig, ...spreeConfig };

View File

@ -6,7 +6,7 @@
"pnpm": ">=8"
},
"scripts": {
"dev": "next dev --turbo",
"dev": "next dev -p 4000 --turbo",
"build": "next build",
"start": "next start",
"lint": "next lint",
@ -24,9 +24,13 @@
"dependencies": {
"@headlessui/react": "^1.7.19",
"@heroicons/react": "^2.1.3",
"@spree/axios-fetcher": "^1.0.0",
"@spree/storefront-api-v2-sdk": "^6.0.6",
"axios": "^1.7.1",
"clsx": "^2.1.0",
"geist": "^1.3.0",
"next": "14.2.2",
"next-i18next": "^15.3.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},

View File

@ -15,6 +15,9 @@
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@commerce/*": ["lib/spree/*"]
},
"noUncheckedIndexedAccess": true,
"plugins": [
{