flpolprojects commited on
Commit
b5185ab
·
verified ·
1 Parent(s): e35954f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -98,10 +98,10 @@ def catalog():
98
 
99
  # Pagination setup
100
  page = request.args.get('page', 1, type=int)
101
- per_page = 10 # 10 products per column
102
 
103
  # Calculate start and end indices for the current page
104
- start = (page - 1) * per_page * 3 # 3 columns per row
105
  end = start + per_page * 3
106
 
107
  # Slice the products list for the current page
@@ -121,8 +121,9 @@ def catalog():
121
  <style>
122
  body {
123
  font-family: Arial, sans-serif;
124
- margin: 20px;
125
  background-color: #f9f9f9;
 
126
  }
127
  h1 {
128
  color: #333;
@@ -131,11 +132,11 @@ def catalog():
131
  .container {
132
  display: flex;
133
  flex-wrap: wrap;
134
- justify-content: space-between;
135
  gap: 20px;
136
  }
137
  .product {
138
- flex: 1 1 calc(30% - 20px); /* Three columns */
139
  background-color: #fff;
140
  border: 1px solid #ddd;
141
  padding: 15px;
@@ -170,6 +171,13 @@ def catalog():
170
  .pagination a:hover:not(.active) {
171
  background-color: #ddd;
172
  }
 
 
 
 
 
 
 
173
  </style>
174
  </head>
175
  <body>
 
98
 
99
  # Pagination setup
100
  page = request.args.get('page', 1, type=int)
101
+ per_page = 6 # Adjusted for mobile view
102
 
103
  # Calculate start and end indices for the current page
104
+ start = (page - 1) * per_page * 3 # 3 columns for bigger screens
105
  end = start + per_page * 3
106
 
107
  # Slice the products list for the current page
 
121
  <style>
122
  body {
123
  font-family: Arial, sans-serif;
124
+ margin: 0; /* Reset default margin */
125
  background-color: #f9f9f9;
126
+ padding: 20px;
127
  }
128
  h1 {
129
  color: #333;
 
132
  .container {
133
  display: flex;
134
  flex-wrap: wrap;
135
+ justify-content: space-around;
136
  gap: 20px;
137
  }
138
  .product {
139
+ flex: 1 1 calc(100% - 20px); /* Full width on mobile */
140
  background-color: #fff;
141
  border: 1px solid #ddd;
142
  padding: 15px;
 
171
  .pagination a:hover:not(.active) {
172
  background-color: #ddd;
173
  }
174
+
175
+ /* Media query for larger screens */
176
+ @media (min-width: 768px) {
177
+ .product {
178
+ flex: 1 1 calc(30% - 20px); /* Three columns on larger screens */
179
+ }
180
+ }
181
  </style>
182
  </head>
183
  <body>