feat: refactor cart item and cart components for improved layout and styling
This commit is contained in:
@@ -1,160 +1,116 @@
|
||||
:host {
|
||||
display: block;
|
||||
--item-media-width: 64px;
|
||||
--item-media-height: 72px;
|
||||
}
|
||||
|
||||
@media (max-width: 420px) {
|
||||
:host {
|
||||
--item-media-width: 56px;
|
||||
--item-media-height: 64px;
|
||||
}
|
||||
}
|
||||
|
||||
.cart-item {
|
||||
display: grid;
|
||||
grid-template-columns: 64px minmax(0, 1fr);
|
||||
grid-template-columns: var(--item-media-width) minmax(0, 1fr);
|
||||
gap: 0.75rem;
|
||||
padding: 10px 12px;
|
||||
border-radius: 0;
|
||||
background-color: #f5f5f5;
|
||||
|
||||
&__media {
|
||||
position: relative;
|
||||
width: 64px;
|
||||
height: 72px;
|
||||
overflow: hidden;
|
||||
border-radius: 6px 0 0 6px;
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
|
||||
&__image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&__image--placeholder {
|
||||
background: linear-gradient(135deg, #d2d2d2, #ececec);
|
||||
}
|
||||
|
||||
&__discount-badge {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
padding: 2px 5px;
|
||||
border-bottom-right-radius: 4px;
|
||||
background-color: #6173ff;
|
||||
color: #ffffff;
|
||||
font-size: 8px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&__content {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&__top-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
&__product {
|
||||
margin: 0;
|
||||
color: #666666;
|
||||
font-size: 12px;
|
||||
font-weight: 325;
|
||||
line-height: 1.25;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
&__prices {
|
||||
display: grid;
|
||||
justify-items: end;
|
||||
white-space: nowrap;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
&__price {
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
&__price--original {
|
||||
font-size: 10px;
|
||||
font-weight: 325;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
&__price--discounted {
|
||||
font-size: 13px;
|
||||
font-weight: 425;
|
||||
}
|
||||
|
||||
&__attributes {
|
||||
display: grid;
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
&__attribute {
|
||||
color: #666666;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
&__attribute-label {
|
||||
font-weight: 325;
|
||||
}
|
||||
|
||||
&__attribute-value {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 0.125rem;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
&__quantity-control,
|
||||
&__quantity {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border: 1px solid #cfcfcf;
|
||||
background-color: #ffffff;
|
||||
color: #666666;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
&__quantity-control {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&__remove {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-left: 0.35rem;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: #b3b3b3;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 420px) {
|
||||
.cart-item {
|
||||
grid-template-columns: 56px minmax(0, 1fr);
|
||||
|
||||
&__media {
|
||||
width: 56px;
|
||||
height: 64px;
|
||||
}
|
||||
}
|
||||
.cart-item-media {
|
||||
width: var(--item-media-width);
|
||||
height: var(--item-media-height);
|
||||
border-radius: 6px 0 0 6px;
|
||||
background-color: #d9d9d9;
|
||||
}
|
||||
|
||||
.cart-item-discount-badge {
|
||||
padding: 2px 5px;
|
||||
border-bottom-right-radius: 4px;
|
||||
background-color: #6173ff;
|
||||
color: #ffffff;
|
||||
font-size: 8px;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.cart-item-placeholder {
|
||||
background: linear-gradient(135deg, #d2d2d2, #ececec);
|
||||
}
|
||||
|
||||
.cart-item-content {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.cart-item-top-row {
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.cart-item-product {
|
||||
color: #666666;
|
||||
font-size: 12px;
|
||||
line-height: 1.25;
|
||||
font-weight: 325;
|
||||
}
|
||||
|
||||
.cart-item-prices {
|
||||
display: grid;
|
||||
justify-items: end;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.cart-item-original-price {
|
||||
color: #a0a0a0;
|
||||
font-size: 10px;
|
||||
font-weight: 325;
|
||||
}
|
||||
|
||||
.cart-item-discounted-price {
|
||||
color: #a0a0a0;
|
||||
font-size: 13px;
|
||||
font-weight: 425;
|
||||
}
|
||||
|
||||
.cart-item-attributes {
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
.cart-item-attribute {
|
||||
color: #666666;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.cart-item-attribute-label {
|
||||
font-weight: 325;
|
||||
}
|
||||
|
||||
.cart-item-actions {
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
.cart-item-qty-btn,
|
||||
.cart-item-qty-value {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-color: #cfcfcf !important;
|
||||
color: #666666;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.cart-item-qty-btn {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.cart-item-remove-btn {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-left: 0.35rem;
|
||||
padding: 0;
|
||||
color: #b3b3b3;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user