Skip to content

Commit

Permalink
tweak product details page title
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaiodias committed Aug 27, 2024
1 parent ee5cbd3 commit 3af7ccf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 39 deletions.
12 changes: 0 additions & 12 deletions client/src/components/shop/productDetails/Details.js

This file was deleted.

43 changes: 26 additions & 17 deletions client/src/components/shop/productDetails/ProductDetailsSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,34 @@ const ProductDetailsSection = (props) => {

if (data.loading) {
return (
<div className="col-span-2 md:col-span-3 lg:col-span-4 flex items-center justify-center h-screen">
<svg
className="w-12 h-12 animate-spin text-gray-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
></path>
</svg>
</div>
<>
<Head pageTitle='Product Details' />

<div className="col-span-2 md:col-span-3 lg:col-span-4 flex items-center justify-center h-screen">
<svg
className="w-12 h-12 animate-spin text-gray-600"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
></path>
</svg>
</div>
</>
);
} else if (!sProduct) {
return <div>No product</div>;
return (
<>
<Head pageTitle='Product not found' />
<div>No product</div>
</>
)
}
return (
<Fragment>
Expand Down
12 changes: 2 additions & 10 deletions client/src/components/shop/productDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@ import {
productDetailsState,
productDetailsReducer,
} from "./ProductDetailsContext";
import Details from "./Details";
import ProductDetailsSection from "./ProductDetailsSection";

export const ProductDetailsContext = createContext();

const DetailsComponent = () => {
return (
<Fragment>
<Details />
</Fragment>
);
};

const ProductDetails = (props) => {
const [data, dispatch] = useReducer(
productDetailsReducer,
Expand All @@ -24,7 +16,7 @@ const ProductDetails = (props) => {
return (
<Fragment>
<ProductDetailsContext.Provider value={{ data, dispatch }}>
<Layout children={<DetailsComponent />} />
<Layout children={<ProductDetailsSection />} />
</ProductDetailsContext.Provider>
</Fragment>
);
Expand Down

0 comments on commit 3af7ccf

Please sign in to comment.