-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from AlbShar/feature/cart
Feature/cart
- Loading branch information
Showing
91 changed files
with
1,512 additions
and
1,158 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
blocks/common.blocks/actions/__cart-quantity/actions__cart-quantity.scss
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
blocks/common.blocks/actions/__cart-svg/actions__cart-svg.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
.actions { | ||
&__cart { | ||
filter: var(--filter); | ||
|
||
@media screen and (min-width: 1123.8px) { | ||
margin-right: 15px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
const modal = document.querySelector('#modal'); | ||
const btnSignIn = document.querySelector('#signIn'); | ||
const showLoginForm = () => { | ||
modal.style.display = "block"; | ||
}; | ||
|
||
function showLoginForm() { | ||
btnSignIn.onclick = () => { | ||
modal.style.display = "block"; | ||
}; | ||
} | ||
|
||
export {showLoginForm, modal}; | ||
export {showLoginForm, btnSignIn, modal}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.btn { | ||
border: none; | ||
background-color: #2f7007; | ||
padding: 7px 15px; | ||
font: 500 0.9rem var(--font-family); | ||
color: #fff; | ||
border-radius: 5px; | ||
text-transform: uppercase; | ||
cursor: pointer; | ||
|
||
&[disabled] { | ||
opacity: 0.5; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,57 @@ | ||
import {cartQuantity} from "../cart/cart.js"; | ||
const burger = document.querySelector('#burger'); | ||
const nav = document.querySelector('#menu'); | ||
const navItems = nav.querySelectorAll('[data-about="actions_item"]'); | ||
const basketWrapper = document.querySelector('#basketWrapper'); | ||
const basketText = document.createElement('div'); | ||
const switchText = document.createElement('div'); | ||
const basketText = document.createElement('span'); | ||
const switchText = document.createElement('span'); | ||
const iconRegistr = document.createElement('span'); | ||
const iconSignIn = document.createElement('span'); | ||
const switchWrapper = document.querySelector('#switchWrapper'); | ||
const registWrapper = document.querySelector('#registWrapper'); | ||
const signInWrapper = document.querySelector('#signInWrapper'); | ||
let clickEvent = ('click' || 'touchstart' || 'touchend' || 'touchcancel' || 'touchmove'); | ||
const cartIcon = document.querySelector('.cart__svg'); | ||
|
||
|
||
function toggleBurger() { | ||
burger.addEventListener(clickEvent ,() => { | ||
const toggleBurger = () => { | ||
document.body.classList.toggle('stop-scroll'); | ||
burger.classList.toggle('burger_active'); | ||
nav.classList.toggle('actions_visible'); | ||
|
||
basketText.innerHTML = "Корзина"; | ||
basketText.className = 'actions__cart-text'; | ||
basketWrapper.append(basketText); | ||
|
||
switchText.innerHTML = "Сменить тему"; | ||
switchText.className = 'switch__text'; | ||
switchText.classList.add('switch__text'); | ||
switchWrapper.append(switchText); | ||
|
||
iconRegistr.style.transform = 'scale(1.3)'; | ||
iconRegistr.className = 'fa fa-user-plus'; | ||
iconRegistr.style.marginLeft = '22px'; | ||
iconRegistr.style.marginRight = '13px'; | ||
iconRegistr.style.filter = 'var(--filter)'; | ||
iconRegistr.classList.add('fa', 'fa-user-plus'); | ||
registWrapper.prepend(iconRegistr); | ||
|
||
iconSignIn.style.transform = 'scale(1.5)'; | ||
iconSignIn.className = 'fa fa-user-circle'; | ||
iconSignIn.style.marginLeft = '20px'; | ||
iconSignIn.style.marginRight = '10px'; | ||
iconSignIn.style.filter = 'var(--filter)'; | ||
iconSignIn.classList.add('fa', 'fa-user-circle'); | ||
signInWrapper.prepend(iconSignIn); | ||
|
||
}); | ||
|
||
navItems.forEach(el => { | ||
el.addEventListener('click', () => { | ||
document.body.classList.remove('stop-scroll'); | ||
burger.classList.remove('burger_active'); | ||
nav.classList.remove('actions_visible'); | ||
if (basketWrapper) { | ||
basketText.classList.add('actions__cart-text'); | ||
basketText.innerHTML = "Корзина"; | ||
basketWrapper.append(basketText); | ||
} | ||
|
||
}; | ||
|
||
const deleteTextCart = (event) => { | ||
if (event.target == cartIcon || event.target.classList.contains('cart-product__delete') || event.target == cartQuantity) { | ||
return ; | ||
} else { | ||
console.log(event.target); | ||
document.body.classList.remove('stop-scroll'); | ||
burger.classList.remove('burger_active'); | ||
nav.classList.remove('actions_visible'); | ||
if (basketWrapper) { | ||
basketText.remove(); | ||
switchText.remove(); | ||
iconRegistr.remove(); | ||
iconSignIn.remove(); | ||
}); | ||
}); | ||
} | ||
|
||
export {toggleBurger}; | ||
} | ||
switchText.remove(); | ||
iconRegistr.remove(); | ||
iconSignIn.remove(); | ||
|
||
} | ||
|
||
}; | ||
|
||
export {toggleBurger, navItems, burger, deleteTextCart}; |
5 changes: 4 additions & 1 deletion
5
blocks/common.blocks/cart-content/__bottom/cart-content__bottom.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.cart-content { | ||
&__bottom { | ||
|
||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 12px 20px; | ||
} | ||
} |
7 changes: 6 additions & 1 deletion
7
blocks/common.blocks/cart-content/__btn/cart-content__btn.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
.cart-content { | ||
&__btn { | ||
|
||
margin-right: 15px; | ||
|
||
@media screen and (max-width: 370px) { | ||
margin-right: 0 !important; | ||
padding: 5px 10px !important; | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
blocks/common.blocks/cart-content/__fullprice-number/cart-content__fullprice-number.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.cart-content { | ||
&__fullprice-number { | ||
font: 700 1rem var(--font-family); | ||
color: var(--color-text-title); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
blocks/common.blocks/cart-content/__fullprice-summary/cart-content__fullprice-summary.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.cart-content { | ||
&__fullprice-summary { | ||
font: 500 1rem var(--font-family); | ||
color: var(--color-text-title); | ||
|
||
} | ||
} |
1 change: 0 additions & 1 deletion
1
.../__fullprace/cart-content__fullprace.scss → .../__fullprice/cart-content__fullprice.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.cart-content { | ||
&__fullprace { | ||
|
||
} | ||
} |
6 changes: 5 additions & 1 deletion
6
blocks/common.blocks/cart-content/__list/cart-content__list.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
.cart-content { | ||
&__list { | ||
|
||
max-height: 330px; | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
overflow-y: scroll; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
blocks/common.blocks/cart-content/_active/cart-content_active.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.cart-content{ | ||
&_active { | ||
opacity: 1; | ||
visibility: visible; | ||
transition: opacity 0.3s, visibility 0.3s; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,33 @@ | ||
.cart-content { | ||
display: none; | ||
cursor: default; | ||
position: absolute; | ||
right: 0; | ||
top: 180%; | ||
background-color: var(--color-bg); | ||
width: 440px; | ||
box-shadow: 0 4px 4px rgba(135,135,135,0.25); | ||
opacity: 0; | ||
visibility: hidden; | ||
transition: opacity 0.3s, visibility 0.3s; | ||
|
||
@media screen and (max-width: 459.9px) { | ||
left: -95px; | ||
width: 360px; | ||
} | ||
|
||
@media screen and (max-width: 370px) { | ||
width: 320px; | ||
|
||
|
||
} | ||
} | ||
|
||
@import "./__bottom/cart-content__bottom.scss"; | ||
@import "./__btn/cart-content__btn.scss"; | ||
@import "./__fullprace/cart-content__fullprace.scss"; | ||
@import "./__fullprice/cart-content__fullprice.scss"; | ||
@import "./__item/cart-content__item.scss"; | ||
@import "./__list/cart-content__list.scss"; | ||
@import "./__product/cart-content__product.scss"; | ||
@import "./__product/cart-content__product.scss"; | ||
@import "./__fullprice-number/cart-content__fullprice-number.scss"; | ||
@import "./__fullprice-summary/cart-content__fullprice-summary.scss"; | ||
@import "./_active/cart-content_active.scss"; | ||
@import "./__btn/cart-content__btn.scss"; |
12 changes: 11 additions & 1 deletion
12
blocks/common.blocks/cart-product/__delete/cart-product__delete.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
.cart-product { | ||
&__delete { | ||
|
||
width: 20px; | ||
height: 20px; | ||
border: none; | ||
padding: 0; | ||
background-color: transparent; | ||
background-image: url(../../blocks/common.blocks/cart-product/delete.svg); | ||
background-size: cover; | ||
background-position: center; | ||
background-repeat:no-repeat ; | ||
cursor: pointer; | ||
filter: var(--filter); | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
blocks/common.blocks/cart-product/__png/cart-product__png.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.cart-product { | ||
&__png { | ||
|
||
max-width: 100px; | ||
max-height: 100%; | ||
object-fit: cover; | ||
margin-right: 20px; | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
blocks/common.blocks/cart-product/__price/cart-product__price.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap'); | ||
|
||
.cart-product { | ||
&__price { | ||
|
||
font: 500 0.8125rem var(--font-family); | ||
color: var(--color-text-subtitle); | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
blocks/common.blocks/cart-product/__text/cart-product__text.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.cart-product { | ||
&__text { | ||
|
||
display: flex; | ||
flex-direction: column; | ||
align-items:flex-start; | ||
flex: 0 1 65% | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
blocks/common.blocks/cart-product/__title/cart-product__title.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.cart-product { | ||
&__title { | ||
|
||
font: 700 0.8125rem var(--font-family); | ||
color: var(--color-text-title); | ||
max-width: 280px; | ||
text-align: left; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.