Skip to content

Commit

Permalink
update readme and fix grid in main page
Browse files Browse the repository at this point in the history
  • Loading branch information
radekm2000 committed May 18, 2024
1 parent db8c143 commit 9a3e31a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ Catalog with filtering

Notifications + main page
![Notifications in navbar](/readmeImages/mainPageShowNotifications.png)

Editing roles
![Editing roles](/readmeImages/EditRole.png)
38 changes: 33 additions & 5 deletions client/ecommerce/src/components/PaginatedProducts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ import { useMediaQuery } from "../hooks/useMediaQuery";
import { Link } from "wouter";
import { RenderAvatar } from "./RenderAvatar";
import { CURRENCY } from "./pages/MenCatalog";
import { calculateGridWidth } from "../utils/calculateGridWidth";

export const PaginatedProducts = () => {
const below1200 = useMediaQuery(1200);
const below700 = useMediaQuery(700);
const below1050 = useMediaQuery(1050);
const below600 = useMediaQuery(600);

const { data, error, status, fetchNextPage, isFetchingNextPage } =
useInfiniteQuery({
queryKey: ["products/paginated"],
Expand All @@ -41,16 +45,40 @@ export const PaginatedProducts = () => {
<div>
{data.pages.map((page) => {
return (
<Grid container key={page.currentPage}>
<Grid sx={{ flexWrap: "wrap" }} container key={page.currentPage}>
{page.data.map((item, index) => {
return (
<Grid
item
key={index}
lg={3}
md={below1200 ? 4 : 3}
xs={below700 ? 12 : 6}
xl={3}
sm={calculateGridWidth(
page.data,
below600,
below700,
below1050,
below1200
)}
xs={calculateGridWidth(
page.data,
below600,
below700,
below1050,
below1200
)}
md={calculateGridWidth(
page.data,
below600,
below700,
below1050,
below1200
)}
lg={calculateGridWidth(
page.data,
below600,
below700,
below1050,
below1200
)}
>
<Card
elevation={0}
Expand Down
2 changes: 1 addition & 1 deletion client/ecommerce/src/components/pages/MenCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useFilteredProducts } from "../../hooks/useFilteredProducts";
import { AccountCircle } from "@mui/icons-material";
import { CatalogSkeleton } from "../skeletons/CatalogSkeleton";
import { RenderAvatar } from "../RenderAvatar";
export const CURRENCY = "PLN";
export const CURRENCY = "USD";

export const MenCatalog = () => {
const below1200 = useMediaQuery(1200);
Expand Down
Binary file added readmeImages/EditRole.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9a3e31a

Please sign in to comment.