4
0
forked from crowetic/commerce

Updates and architecture reorder

This commit is contained in:
Belen Curcio 2020-09-29 19:13:06 -03:00
parent 702f00933d
commit 7c890c7587
10 changed files with 51 additions and 36 deletions

View File

@ -0,0 +1,3 @@
.root {
@apply h-full border-indigo-900;
}

View 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;

View File

@ -0,0 +1 @@
export { default } from "./Layout";

View File

@ -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";

View File

@ -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"
description="Due to COVID-19, some orders may experience processing and delivery delays."
/>
<Navbar />
<Container className="h-screen">
<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-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-black h-full"></div>
<div className="lg:row-span-1 lg:col-span-1 bg-pink"></div> <div className="lg:row-span-1 lg:col-span-1 bg-pink"></div>
</div> </div>
</Container> </Layout>
<Footer></Footer>
</>
); );
} }

View File

@ -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
title="Free Standard Shipping on orders over $99.99"
description="Due to COVID-19, some orders may experience processing and delivery delays."
/>
<Navbar />
<Container className="h-screen">
{router.isFallback ? ( {router.isFallback ? (
<h1>Loading...</h1> <h1>Loading...</h1>
) : ( ) : (
<ProductView productData={productData} /> <ProductView productData={productData} />
)} )}
</Container> </Layout>
<Footer></Footer>
</>
); );
} }

View File

@ -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";