feat: improve catalog responsive design, cart layout and card component
- Redesign Cart component with improved alignments, gaps, and responsive padding - Refactor Card component with mobile-first layout and consistent spacing - Update catalog layout to 60/40 split for products/cart on desktop (lg) - Add PaginationControls component (previously untracked) - Clean up obsolete CSS styles from catalog page
This commit is contained in:
@@ -1,26 +1,37 @@
|
||||
<template>
|
||||
<v-card class="product-card">
|
||||
<v-row no-gutters align="center" class="w-100 py-3 px-2">
|
||||
<v-col cols="12" md="3" class="d-flex justify-center">
|
||||
<v-row align="start" class="product-card-row">
|
||||
<!-- Columna de Imagen -->
|
||||
<v-col cols="12" md="4" class="image-column">
|
||||
<v-img :src="product.img" class="product-img" contain></v-img>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="5">
|
||||
<v-card-title class="product-name">{{ product.name }}</v-card-title>
|
||||
<v-card-subtitle class="product-description">{{ product.description }}</v-card-subtitle>
|
||||
<div class="prices mt-3">
|
||||
<div class="price-unit">
|
||||
<span class="price-label">Precio unitario</span>
|
||||
<span class="price-value">{{ currency(product.price) }}</span>
|
||||
</div>
|
||||
<div class="price-total">
|
||||
<span class="price-label">Precio total</span>
|
||||
<span class="price-value total">{{ currency(product.price * product.quantity) }}</span>
|
||||
<!-- Columna de Detalles -->
|
||||
<v-col cols="12" md="5" class="details-column">
|
||||
<div class="product-details-content">
|
||||
<v-card-title class="product-name">{{ product.name }}</v-card-title>
|
||||
<v-card-subtitle class="product-description">{{
|
||||
product.description
|
||||
}}</v-card-subtitle>
|
||||
|
||||
<div class="prices">
|
||||
<div class="price-unit">
|
||||
<span class="price-label">Precio unitario</span>
|
||||
<span class="price-value">{{ currency(product.price) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="price-total">
|
||||
<span class="price-label">Precio total</span>
|
||||
<span class="price-value total"
|
||||
>{{ currency(product.price * product.quantity) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" md="4" class="d-flex align-center justify-md-end justify-center mt-3 mt-md-0">
|
||||
<!-- Columna de Controles -->
|
||||
<v-col cols="12" md="3" class="controls-column">
|
||||
<div class="quantity-controls">
|
||||
<v-btn icon small class="qty-btn" @click="decrease(product)">
|
||||
<v-icon small>mdi-minus</v-icon>
|
||||
@@ -50,153 +61,431 @@ export default {
|
||||
props: {
|
||||
product: {
|
||||
type: Object,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
increase: {
|
||||
type: Function,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
decrease: {
|
||||
type: Function,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
currency: {
|
||||
type: Function,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
updateQuantity: {
|
||||
type: Function,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleIncrease() {
|
||||
this.increase(this.product);
|
||||
this.$emit('add-to-cart', this.product);
|
||||
this.$emit("add-to-cart", this.product);
|
||||
},
|
||||
handleQuantityChange(value) {
|
||||
this.updateQuantity(this.product);
|
||||
if (this.product.quantity > 0) {
|
||||
this.$emit('add-to-cart', this.product);
|
||||
this.$emit("add-to-cart", this.product);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ===== ESTILOS BASE - MOBILE FIRST (< 560px) ===== */
|
||||
|
||||
/* Card Container */
|
||||
.product-card {
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 12px;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
|
||||
transition: all 0.3s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.product-card:hover {
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
||||
transform: translateY(-2px);
|
||||
border-color: #bdbdbd;
|
||||
}
|
||||
|
||||
/* Row Container */
|
||||
.product-card-row {
|
||||
padding: 12px 8px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* === COLUMNA DE IMAGEN === */
|
||||
.image-column {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0 0 16px 0;
|
||||
}
|
||||
|
||||
.product-img {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 10px;
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
border-radius: 12px;
|
||||
object-fit: cover;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.product-card:hover .product-img {
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
/* === COLUMNA DE DETALLES === */
|
||||
.details-column {
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.product-details-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 1.1rem;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
line-height: 1.3;
|
||||
padding: 0 0 4px 0;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.8rem;
|
||||
color: #7f8c8d;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
/* === PRECIOS === */
|
||||
.prices {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.price-unit, .price-total {
|
||||
|
||||
.price-unit,
|
||||
.price-total {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.price-label {
|
||||
font-size: 0.75rem;
|
||||
font-size: 0.7rem;
|
||||
color: #95a5a6;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
.price-value.total {
|
||||
color: #27ae60;
|
||||
font-size: 1.1rem;
|
||||
background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
|
||||
color: white;
|
||||
padding: 3px 10px;
|
||||
border-radius: 20px;
|
||||
font-size: 0.95rem;
|
||||
box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* === COLUMNA DE CONTROLES === */
|
||||
.controls-column {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px 0 0 0;
|
||||
}
|
||||
|
||||
.quantity-controls {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: 6px;
|
||||
background: #f5f5f5;
|
||||
border-radius: 25px;
|
||||
padding: 4px;
|
||||
padding: 6px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.quantity-input {
|
||||
max-width: 70px;
|
||||
max-width: 60px;
|
||||
min-width: 60px;
|
||||
}
|
||||
|
||||
.quantity-input input {
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
min-width: 32px !important;
|
||||
width: 32px !important;
|
||||
height: 32px !important;
|
||||
border-radius: 50% !important;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
transition: all 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.qty-btn:hover {
|
||||
background: #e0e0e0;
|
||||
transform: scale(1.08);
|
||||
}
|
||||
|
||||
.qty-btn-add {
|
||||
background: #27ae60;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.qty-btn-add:hover {
|
||||
background: #219a52 !important;
|
||||
}
|
||||
@media (max-width: 960px) {
|
||||
|
||||
/* ===== RESOLUCIÓN 375-559px (Mobile Standard) ===== */
|
||||
@media (min-width: 375px) and (max-width: 559px) {
|
||||
.product-img {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.product-card {
|
||||
border-radius: 8px;
|
||||
}
|
||||
.product-img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
|
||||
.product-card-row {
|
||||
padding: 14px 10px;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.quantity-input {
|
||||
max-width: 65px;
|
||||
min-width: 65px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== RESOLUCIÓN 560-959px (Tablet) ===== */
|
||||
@media (min-width: 560px) and (max-width: 959px) {
|
||||
.product-card-row {
|
||||
padding: 16px 12px;
|
||||
}
|
||||
|
||||
.image-column {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.product-img {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.product-details-content {
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.prices {
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.price-label {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.price-value.total {
|
||||
font-size: 1rem;
|
||||
padding: 4px 12px;
|
||||
}
|
||||
|
||||
.controls-column {
|
||||
padding-top: 18px;
|
||||
}
|
||||
|
||||
.quantity-input {
|
||||
max-width: 70px;
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
min-width: 34px !important;
|
||||
width: 34px !important;
|
||||
height: 34px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== RESOLUCIÓN ≥960px (Desktop) ===== */
|
||||
@media (min-width: 960px) {
|
||||
.product-card {
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.product-card:hover {
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
|
||||
.product-card:hover .product-img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.product-card-row {
|
||||
padding: 16px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.image-column {
|
||||
padding: 0 24px 0 0;
|
||||
margin-bottom: 0;
|
||||
max-width: 380px;
|
||||
}
|
||||
|
||||
.product-img {
|
||||
width: 350px;
|
||||
height: 350px;
|
||||
}
|
||||
|
||||
.details-column {
|
||||
padding: 0 24px 0 0;
|
||||
border-right: 1px solid #e0e0e0;
|
||||
flex: 1;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.product-details-content {
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 1.15rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.9rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.prices {
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.price-unit,
|
||||
.price-total {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.price-label {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.price-value.total {
|
||||
font-size: 1.05rem;
|
||||
padding: 4px 12px;
|
||||
}
|
||||
|
||||
.controls-column {
|
||||
justify-content: flex-end;
|
||||
margin-top: 0;
|
||||
padding: 0 0 0 16px;
|
||||
min-width: 180px;
|
||||
}
|
||||
|
||||
.quantity-controls {
|
||||
gap: 8px;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.quantity-input {
|
||||
max-width: 70px;
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
min-width: 36px !important;
|
||||
width: 36px !important;
|
||||
height: 36px !important;
|
||||
}
|
||||
|
||||
.qty-btn:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== RESOLUCIÓN ≥1280px (Desktop Large) ===== */
|
||||
@media (min-width: 1280px) {
|
||||
.product-card-row {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.image-column {
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.details-column {
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.product-description {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.controls-column {
|
||||
padding-left: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user