forked from crowetic/commerce
Updates and architecture reorder
This commit is contained in:
parent
702f00933d
commit
7c890c7587
3
components/Layout/Layout.module.css
Normal file
3
components/Layout/Layout.module.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
.root {
|
||||||
|
@apply h-full border-indigo-900;
|
||||||
|
}
|
26
components/Layout/Layout.tsx
Normal file
26
components/Layout/Layout.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import cn from "classnames";
|
||||||
|
import React, { FunctionComponent } from "react";
|
||||||
|
import s from "./Layout.module.css";
|
||||||
|
import { Navbar, Featurebar } from "components";
|
||||||
|
import { Container } from "ui";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
className?: string;
|
||||||
|
children?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Layout: FunctionComponent<Props> = ({ className, children }) => {
|
||||||
|
const rootClassName = cn(s.root, className);
|
||||||
|
return (
|
||||||
|
<Container className={rootClassName}>
|
||||||
|
<Featurebar
|
||||||
|
title="Free Standard Shipping on orders over $99.99"
|
||||||
|
description="Due to COVID-19, some orders may experience processing and delivery delays."
|
||||||
|
/>
|
||||||
|
<Navbar />
|
||||||
|
<main className="h-screen">{children}</main>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Layout;
|
1
components/Layout/index.ts
Normal file
1
components/Layout/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default } from "./Layout";
|
@ -3,3 +3,5 @@ export { default as Footer } from "./Footer";
|
|||||||
export { default as Navbar } from "./Navbar";
|
export { default as Navbar } from "./Navbar";
|
||||||
export { default as Searchbar } from "./Searchbar";
|
export { default as Searchbar } from "./Searchbar";
|
||||||
export { default as ProductView } from "./ProductView";
|
export { default as ProductView } from "./ProductView";
|
||||||
|
export { default as Layout } from "./Layout";
|
||||||
|
export { default as Featurebar } from "./Featurebar";
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
import { Featurebar, Button, Container } from "ui";
|
import { Layout } from "components";
|
||||||
import { Navbar, Footer } from "components";
|
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<>
|
<Layout>
|
||||||
<Featurebar
|
<div className="h-full grid grid-cols-1 h-full lg:grid-cols-3 lg:grid-rows-2">
|
||||||
title="Free Standard Shipping on orders over $99.99"
|
<div className="lg:row-span-2 lg:col-span-2 bg-violet h-full"></div>
|
||||||
description="Due to COVID-19, some orders may experience processing and delivery delays."
|
<div className="lg:row-span-1 lg:col-span-1 bg-black h-full"></div>
|
||||||
/>
|
<div className="lg:row-span-1 lg:col-span-1 bg-pink"></div>
|
||||||
<Navbar />
|
</div>
|
||||||
<Container className="h-screen">
|
</Layout>
|
||||||
<div className="grid grid-cols-1 h-full lg:grid-cols-3 lg:grid-rows-2">
|
|
||||||
<div className="lg:row-span-2 lg:col-span-2 bg-violet h-full"></div>
|
|
||||||
<div className="lg:row-span-1 lg:col-span-1 bg-black h-full"></div>
|
|
||||||
<div className="lg:row-span-1 lg:col-span-1 bg-pink"></div>
|
|
||||||
</div>
|
|
||||||
</Container>
|
|
||||||
<Footer></Footer>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { Featurebar, Button, Container } from "ui";
|
import { ProductView, Layout } from "components";
|
||||||
import { Navbar, Footer, ProductView } from "components";
|
|
||||||
import ErrorPage from "next/error";
|
import ErrorPage from "next/error";
|
||||||
|
|
||||||
export async function getStaticProps() {
|
export async function getStaticProps() {
|
||||||
@ -18,33 +17,26 @@ export async function getStaticProps() {
|
|||||||
props: {
|
props: {
|
||||||
productData,
|
productData,
|
||||||
},
|
},
|
||||||
|
revalidate: 200,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
return {
|
return {
|
||||||
paths: [],
|
paths: [],
|
||||||
fallback: true,
|
fallback: "unstable_blocking",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Home({ productData }) {
|
export default function Home({ productData }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return (
|
return (
|
||||||
<>
|
<Layout>
|
||||||
<Featurebar
|
{router.isFallback ? (
|
||||||
title="Free Standard Shipping on orders over $99.99"
|
<h1>Loading...</h1>
|
||||||
description="Due to COVID-19, some orders may experience processing and delivery delays."
|
) : (
|
||||||
/>
|
<ProductView productData={productData} />
|
||||||
<Navbar />
|
)}
|
||||||
<Container className="h-screen">
|
</Layout>
|
||||||
{router.isFallback ? (
|
|
||||||
<h1>Loading...</h1>
|
|
||||||
) : (
|
|
||||||
<ProductView productData={productData} />
|
|
||||||
)}
|
|
||||||
</Container>
|
|
||||||
<Footer></Footer>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export { default as Button } from "./Button";
|
export { default as Button } from "./Button";
|
||||||
export { default as Container } from "./Container";
|
export { default as Container } from "./Container";
|
||||||
export { default as Featurebar } from "./Featurebar";
|
|
||||||
export { default as Logo } from "./Logo";
|
export { default as Logo } from "./Logo";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user