From 8abf64ca387f499868e1a0cbf00c41cfa6846b67 Mon Sep 17 00:00:00 2001 From: seb Date: Fri, 4 Jul 2025 04:51:15 +0200 Subject: [PATCH] Enhance responsive design across components by adjusting padding, margins, and layout properties for better mobile usability. Updated styles in Content, Header, Product, ProductFilters, ProductList, and SearchBar components to improve visual consistency and user experience on various screen sizes. --- src/components/Content.js | 24 ++----- src/components/Header.js | 31 ++++++-- src/components/Product.js | 13 ++-- src/components/ProductFilters.js | 12 ++-- src/components/ProductList.js | 109 ++++++++++++++++++++++++----- src/components/header/SearchBar.js | 2 +- 6 files changed, 140 insertions(+), 51 deletions(-) diff --git a/src/components/Content.js b/src/components/Content.js index 4888d5b..8c03e21 100644 --- a/src/components/Content.js +++ b/src/components/Content.js @@ -441,7 +441,7 @@ class Content extends Component { return ( - + {showCategoryBoxes ? ( // Show category boxes layout when no products but have child categories @@ -491,30 +491,20 @@ class Content extends Component { {/* Subcategories Grid */} - - + + ); } else { - // Just show subcategories without parent - return ( - - ); + // No parent category, just show subcategories + return ; } })()} )} - {/* Show parent category navigation when in 2nd or 3rd level but no subcategories */} + {/* Show standalone parent category navigation when there are only products */} {this.state.loaded && this.props.params.categoryId && !(this.state.unfilteredProducts.length > 0 && this.state.childCategories.length > 0) && (() => { @@ -558,7 +548,7 @@ class Content extends Component { - - + + {/* First row: Logo and ButtonGroup on xs, all items on larger screens */} {/* SearchBar visible on sm and up */} - + + + - {/* Second row: SearchBar only on xs */} + {/* Second row: SearchBar only on xs - make it wider */} - + + + diff --git a/src/components/Product.js b/src/components/Product.js index c72386e..5fee10e 100644 --- a/src/components/Product.js +++ b/src/components/Product.js @@ -180,18 +180,21 @@ class Product extends Component { diff --git a/src/components/ProductFilters.js b/src/components/ProductFilters.js index 4c26e61..9be4dd2 100644 --- a/src/components/ProductFilters.js +++ b/src/components/ProductFilters.js @@ -162,13 +162,17 @@ class ProductFilters extends Component { return ( diff --git a/src/components/ProductList.js b/src/components/ProductList.js index d4d6f39..cccd469 100644 --- a/src/components/ProductList.js +++ b/src/components/ProductList.js @@ -123,8 +123,14 @@ class ProductList extends Component { renderPagination = (pages, page) => { return ( - - {((this.state.itemsPerPage==='all')||(this.props.products.length + {(this.state.itemsPerPage==='all')?null: + - + {this.props.activeAttributeFilters.map((filter,index) => ( - + {/* Sort Dropdown */} - + Sortierung Alle + + {/* Product count info - mobile only */} + + + { + this.props.totalProductCount==this.props.products.length && this.props.totalProductCount>0 ? + `${this.props.totalProductCount} Produkte` + : + `${this.props.products.length} von ${this.props.totalProductCount} Produkte` + } + + - { this.renderPagination(Math.ceil(filteredProducts.length / this.state.itemsPerPage), this.state.page) } - + + { this.renderPagination(Math.ceil(filteredProducts.length / this.state.itemsPerPage), this.state.page) } + + {/*this.props.dataType == 'category' && (<>Kategorie: {this.props.dataParam})}*/} {this.props.dataType == 'search' && (<>Suchergebnisse für: "{this.props.dataParam}")} @@ -303,14 +363,19 @@ class ProductList extends Component { - - {products.map((product) => ( + + {products.map((product, index) => ( ))} - - {this.renderPagination(Math.ceil(filteredProducts.length / this.state.itemsPerPage), this.state.page)} + + {/* Bottom pagination */} + + + {this.renderPagination(Math.ceil(filteredProducts.length / this.state.itemsPerPage), this.state.page)} + + ); } diff --git a/src/components/header/SearchBar.js b/src/components/header/SearchBar.js index 92c131e..d52891e 100644 --- a/src/components/header/SearchBar.js +++ b/src/components/header/SearchBar.js @@ -219,7 +219,7 @@ const SearchBar = () => { onSubmit={handleSearch} sx={{ flexGrow: 1, - mx: { xs: 1, sm: 2, md: 4 }, + mx: { xs: 0, sm: 2, md: 4 }, position: "relative", }} >