flpolprojects commited on
Commit
e034a6e
·
verified ·
1 Parent(s): 198bca2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -57
app.py CHANGED
@@ -117,17 +117,17 @@ def catalog():
117
  }
118
  body {
119
  font-family: 'Poppins', sans-serif;
120
- background: linear-gradient(135deg, #f0f2f5, #e9ecef);
121
- color: #2d3748;
122
  line-height: 1.6;
123
  transition: background 0.3s, color 0.3s;
124
  }
125
  body.dark-mode {
126
- background: linear-gradient(135deg, #1a202c, #2d3748);
127
  color: #e2e8f0;
128
  }
129
  .container {
130
- max-width: 1300px;
131
  margin: 0 auto;
132
  padding: 20px;
133
  }
@@ -211,31 +211,32 @@ def catalog():
211
  }
212
  .products-grid {
213
  display: grid;
214
- grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
215
- gap: 20px;
216
  padding: 10px;
217
  }
218
  .product {
219
  background: #fff;
220
- border-radius: 15px;
221
- padding: 15px;
222
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
223
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
224
  overflow: hidden;
 
225
  }
226
  body.dark-mode .product {
227
  background: #2d3748;
228
  color: #fff;
229
  }
230
  .product:hover {
231
- transform: translateY(-5px) scale(1.02);
232
- box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
233
  }
234
  .product-image {
235
  width: 100%;
236
  aspect-ratio: 1;
237
  background-color: #fff;
238
- border-radius: 10px;
239
  overflow: hidden;
240
  display: flex;
241
  justify-content: center;
@@ -250,67 +251,83 @@ def catalog():
250
  .product-image img:hover {
251
  transform: scale(1.1);
252
  }
253
- .product h2 {
254
- font-size: 1.2rem;
 
 
 
 
 
 
255
  font-weight: 600;
256
- margin: 10px 0;
257
- text-align: center;
 
258
  white-space: nowrap;
259
  overflow: hidden;
260
  text-overflow: ellipsis;
261
  }
 
 
 
262
  .product-price {
263
- font-size: 1.3rem;
264
- color: #ef4444;
265
  font-weight: 700;
266
- text-align: center;
267
- margin: 5px 0;
268
  }
269
- .product-description {
270
  font-size: 0.9rem;
271
- color: #718096;
272
- text-align: center;
273
- margin-bottom: 15px;
274
- overflow: hidden;
275
- text-overflow: ellipsis;
276
- white-space: nowrap;
277
- }
278
- body.dark-mode .product-description {
279
- color: #a0aec0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  }
281
  .product-button {
282
  display: block;
283
  width: 100%;
284
- padding: 10px;
285
  border: none;
286
- border-radius: 8px;
287
- background-color: #3b82f6;
288
  color: white;
289
  font-size: 0.9rem;
290
  font-weight: 500;
291
  cursor: pointer;
292
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
293
- margin: 5px 0;
294
  text-align: center;
295
  text-decoration: none;
296
  }
297
  .product-button:hover {
298
- background-color: #2563eb;
299
- box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
300
  transform: translateY(-2px);
301
  }
302
- .add-to-cart {
303
- background-color: #10b981;
304
- }
305
- .add-to-cart:hover {
306
- background-color: #059669;
307
- box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
308
- }
309
  #cart-button {
310
  position: fixed;
311
  bottom: 20px;
312
  right: 20px;
313
- background-color: #ef4444;
314
  color: white;
315
  border: none;
316
  border-radius: 50%;
@@ -413,20 +430,17 @@ def catalog():
413
  @media (max-width: 768px) {
414
  .products-grid {
415
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
416
- gap: 15px;
417
  }
418
- .product h2 {
419
- font-size: 1rem;
420
  }
421
  .product-price {
422
- font-size: 1.1rem;
423
- }
424
- .product-description {
425
- font-size: 0.8rem;
426
  }
427
  .product-button {
428
  font-size: 0.8rem;
429
- padding: 8px;
430
  }
431
  .header-logo {
432
  width: 50px;
@@ -464,6 +478,8 @@ def catalog():
464
  data-name="{{ product['name']|lower }}"
465
  data-description="{{ product['description']|lower }}"
466
  data-category="{{ product.get('category', 'Без категории') }}">
 
 
467
  {% if product.get('photos') and product['photos']|length > 0 %}
468
  <div class="product-image">
469
  <img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"
@@ -471,11 +487,11 @@ def catalog():
471
  loading="lazy">
472
  </div>
473
  {% endif %}
474
- <h2>{{ product['name'] }}</h2>
475
- <div class="product-price">{{ product['price'] }} с</div>
476
- <p class="product-description">{{ product['description'][:50] }}{% if product['description']|length > 50 %}...{% endif %}</p>
477
- <button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button>
478
- <button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
479
  </div>
480
  {% endfor %}
481
  </div>
 
117
  }
118
  body {
119
  font-family: 'Poppins', sans-serif;
120
+ background: #f5f5f5;
121
+ color: #333;
122
  line-height: 1.6;
123
  transition: background 0.3s, color 0.3s;
124
  }
125
  body.dark-mode {
126
+ background: #1a202c;
127
  color: #e2e8f0;
128
  }
129
  .container {
130
+ max-width: 1200px;
131
  margin: 0 auto;
132
  padding: 20px;
133
  }
 
211
  }
212
  .products-grid {
213
  display: grid;
214
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
215
+ gap: 15px;
216
  padding: 10px;
217
  }
218
  .product {
219
  background: #fff;
220
+ border-radius: 10px;
221
+ padding: 10px;
222
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
223
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
224
  overflow: hidden;
225
+ position: relative;
226
  }
227
  body.dark-mode .product {
228
  background: #2d3748;
229
  color: #fff;
230
  }
231
  .product:hover {
232
+ transform: translateY(-5px);
233
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
234
  }
235
  .product-image {
236
  width: 100%;
237
  aspect-ratio: 1;
238
  background-color: #fff;
239
+ border-radius: 8px;
240
  overflow: hidden;
241
  display: flex;
242
  justify-content: center;
 
251
  .product-image img:hover {
252
  transform: scale(1.1);
253
  }
254
+ .product-header {
255
+ display: flex;
256
+ justify-content: space-between;
257
+ align-items: center;
258
+ margin-top: 5px;
259
+ }
260
+ .product-title {
261
+ font-size: 1rem;
262
  font-weight: 600;
263
+ margin: 5px 0;
264
+ color: #333;
265
+ text-align: left;
266
  white-space: nowrap;
267
  overflow: hidden;
268
  text-overflow: ellipsis;
269
  }
270
+ body.dark-mode .product-title {
271
+ color: #e2e8f0;
272
+ }
273
  .product-price {
274
+ font-size: 1.1rem;
275
+ color: #ff4444;
276
  font-weight: 700;
277
+ text-align: right;
 
278
  }
279
+ .product-old-price {
280
  font-size: 0.9rem;
281
+ color: #999;
282
+ text-decoration: line-through;
283
+ margin-right: 5px;
284
+ }
285
+ .discount-badge {
286
+ position: absolute;
287
+ top: 10px;
288
+ left: 10px;
289
+ background: #ff4444;
290
+ color: white;
291
+ padding: 5px 10px;
292
+ border-radius: 5px;
293
+ font-size: 0.8rem;
294
+ }
295
+ .installment-badge {
296
+ position: absolute;
297
+ top: 10px;
298
+ right: 10px;
299
+ background: #00b894;
300
+ color: white;
301
+ padding: 5px 10px;
302
+ border-radius: 5px;
303
+ font-size: 0.8rem;
304
  }
305
  .product-button {
306
  display: block;
307
  width: 100%;
308
+ padding: 8px;
309
  border: none;
310
+ border-radius: 5px;
311
+ background-color: #4CAF50;
312
  color: white;
313
  font-size: 0.9rem;
314
  font-weight: 500;
315
  cursor: pointer;
316
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
317
+ margin-top: 10px;
318
  text-align: center;
319
  text-decoration: none;
320
  }
321
  .product-button:hover {
322
+ background-color: #45a049;
323
+ box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
324
  transform: translateY(-2px);
325
  }
 
 
 
 
 
 
 
326
  #cart-button {
327
  position: fixed;
328
  bottom: 20px;
329
  right: 20px;
330
+ background-color: #ff4444;
331
  color: white;
332
  border: none;
333
  border-radius: 50%;
 
430
  @media (max-width: 768px) {
431
  .products-grid {
432
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
433
+ gap: 10px;
434
  }
435
+ .product-title {
436
+ font-size: 0.9rem;
437
  }
438
  .product-price {
439
+ font-size: 1rem;
 
 
 
440
  }
441
  .product-button {
442
  font-size: 0.8rem;
443
+ padding: 6px;
444
  }
445
  .header-logo {
446
  width: 50px;
 
478
  data-name="{{ product['name']|lower }}"
479
  data-description="{{ product['description']|lower }}"
480
  data-category="{{ product.get('category', 'Без категории') }}">
481
+ <div class="discount-badge">5% скидка</div>
482
+ <div class="installment-badge">0-12</div>
483
  {% if product.get('photos') and product['photos']|length > 0 %}
484
  <div class="product-image">
485
  <img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"
 
487
  loading="lazy">
488
  </div>
489
  {% endif %}
490
+ <div class="product-header">
491
+ <div class="product-title">{{ product['name'] }}</div>
492
+ <div class="product-price">{{ product['price'] }} с</div>
493
+ </div>
494
+ <button class="product-button" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>
495
  </div>
496
  {% endfor %}
497
  </div>