Skip to content

Commit

Permalink
feat: cart styles
Browse files Browse the repository at this point in the history
  • Loading branch information
YulikK committed Jun 11, 2024
1 parent f5bc7a5 commit e9a198b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/entities/Coupon/view/couponView.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@
font: var(--regular-font);
color: var(--noble-gray-800);
transition: all 0.2s;

@media (max-width: 768px) {
color: var(--noble-gray-1100);
}
}
4 changes: 4 additions & 0 deletions src/entities/Summary/view/summaryView.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
font: var(--regular-font);
color: var(--noble-gray-800);
transition: all 0.2s;

@media (max-width: 768px) {
color: var(--noble-gray-1100);
}
}

.couponsWrap:not(:empty)::after {
Expand Down
9 changes: 6 additions & 3 deletions src/pages/CartPage/view/CartPageView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class CartPageView {
}

private addTableHeader(): void {
const productsWrap = createBaseElement({ cssClasses: [styles.productsWrap], tag: 'div' });
this.table = createBaseElement({ cssClasses: [styles.table], tag: 'table' });
const thead = createBaseElement({ cssClasses: [styles.thead, styles.head], tag: 'thead' });
const tr = createBaseElement({ cssClasses: [styles.tr, styles.head], tag: 'tr' });
Expand Down Expand Up @@ -161,10 +162,12 @@ class CartPageView {
this.table.append(thead, this.tableBody);
thead.append(tr);
tr.append(thImage, thProduct, thPrice, thQuantity, thTotal, thDelete);
this.productWrap.append(this.table);
productsWrap.append(this.table);
this.productWrap.append(productsWrap);
}

private addTotalInfo(): void {
const totalBlockWrap = createBaseElement({ cssClasses: [styles.totalsWrap], tag: 'div' });
const title = createBaseElement({
cssClasses: [styles.totalTitle, styles.border, styles.mobileHide],
innerContent: TITLE.CART_TOTAL[this.language],
Expand All @@ -189,19 +192,19 @@ class CartPageView {
this.textElement.push({ element: finalButton, textItem: TITLE.BUTTON_CHECKOUT });
const continueLink = this.createCatalogLinkHTML();
continueLink.getHTML().classList.add(styles.mobileHide);
this.totalWrap.append(
totalBlockWrap.append(
title,
couponTitle,
couponWrap,
this.productCouponSummary.getHTML(),
subtotalWrap,

this.cartCouponSummary.getHTML(),
discountWrap,
totalWrap,
finalButton,
continueLink.getHTML(),
);
this.totalWrap.append(totalBlockWrap);
}

private createCatalogLinkHTML(): LinkModel {
Expand Down
43 changes: 39 additions & 4 deletions src/pages/CartPage/view/cartPageView.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
.cartPage {
display: flex;
flex-grow: 1;
overflow: hidden;
padding: 0 var(--small-offset);
animation: show 0.2s ease-out forwards;
gap: 2%;

Expand Down Expand Up @@ -33,19 +31,22 @@
}

.total {
position: sticky;
top: calc(var(--extra-small-offset) * 3.5);
flex-shrink: 1;
height: max-content;

@media (max-width: 768px) {
position: sticky;
left: 0;
bottom: 0;
z-index: 100;
margin: 0 var(--small-offset);
margin-bottom: var(--tiny-offset);
border-radius: var(--large-br);
padding: var(--small-offset);
width: 100%;
box-shadow: var(--mellow-shadow-700);
background-color: var(--white-tr);
background-color: var(--noble-gray-1000);
backdrop-filter: blur(10px);
}
}
Expand All @@ -55,7 +56,14 @@
}

.thead {
position: sticky;
top: calc(var(--extra-small-offset) * 3.5);
width: 100%;
background: var(--noble-white-100);

@media (max-width: 768px) {
position: static;
}
}

.mainText {
Expand Down Expand Up @@ -101,6 +109,10 @@
padding: var(--tiny-offset) 0;
font: var(--bold-font);
color: var(--noble-gray-800);

@media (max-width: 768px) {
color: var(--noble-gray-1100);
}
}

.border {
Expand All @@ -112,6 +124,10 @@
font: var(--regular-font);
color: var(--noble-gray-800);
transition: all 0.2s;

@media (max-width: 768px) {
color: var(--noble-gray-1100);
}
}

.totalWrap {
Expand Down Expand Up @@ -264,3 +280,22 @@ $color: var(--steam-green-800);
display: flex;
align-items: center;
}

.productsWrap {
padding-left: var(--small-offset);

@media (max-width: 768px) {
overflow: hidden;
padding: 0 var(--small-offset);
}
}

.totalsWrap {
display: flex;
flex-direction: column;
padding-right: var(--small-offset);

@media (max-width: 768px) {
padding: 0;
}
}
4 changes: 2 additions & 2 deletions src/widgets/ProductOrder/view/productOrderView.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
}

.swipeRow {
transform: translateX(calc(var(--extra-large-offset) * -1));
transform: translateX(-25%);
}

.swipeDelete {
transform: translateX(calc(var(--extra-large-offset) * 1.5));
transform: translateX(85%);
}

.deleteCell {
Expand Down

0 comments on commit e9a198b

Please sign in to comment.