Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 3c11395

Browse files
authored
Merge pull request #97 from solidusio/revert-96-revert-91-mfrecchiami/demo-marketing-proposal
Demo restyling
2 parents 30485b9 + 23a576d commit 3c11395

File tree

239 files changed

+5041
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

239 files changed

+5041
-16
lines changed

app/assets/.DS_Store

6 KB
Binary file not shown.

app/assets/images/about-image.jpg

127 KB
Loading

app/assets/images/hero-bg.jpg

337 KB
Loading
59.4 KB
Loading
Loading

app/assets/images/icon-delete.svg

+5
Loading

app/assets/images/icon-search.svg

+4
Loading
+5
Loading

app/assets/images/ruby-category.jpg

58.9 KB
Loading
30.3 KB
Loading
113 KB
Loading
657 KB
Loading

app/assets/javascripts/accordion.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$(document).ready(function(){
2+
$('.toggle-accordion').click(function(e) {
3+
e.preventDefault();
4+
5+
let $this = $(this);
6+
7+
//changes arrow
8+
if( $(this).hasClass('js-arrow-up')){
9+
$(this).removeClass('js-arrow-up').addClass('js-arrow-down');
10+
} else {
11+
$(this).removeClass('js-arrow-up').addClass('js-arrow-down');
12+
$(this).removeClass('js-arrow-down').addClass('js-arrow-up');
13+
}
14+
15+
if ($this.next().hasClass('js-show-list')) {
16+
$this.next().removeClass('js-show-list');
17+
$this.next().slideUp(350);
18+
} else {
19+
$this.parent().parent().find('li .inner').removeClass('js-show-list');
20+
$this.parent().parent().find('li .inner').slideUp(350);
21+
$this.next().toggleClass('js-show-list');
22+
$this.next().slideToggle(350);
23+
}
24+
});
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
document.addEventListener("DOMContentLoaded", function () {
2+
const optionTypeSelector = document.querySelectorAll(".selection-items");
3+
for (var i = 0; i < optionTypeSelector.length; i++) {
4+
optionTypeSelector[i].addEventListener("click", onSelection);
5+
}
6+
selectFirstVariant();
7+
});
8+
9+
function selectFirstVariant() {
10+
const firstVariant = document.querySelector("[data-option-index]");
11+
if (firstVariant) {
12+
setTimeout(() => { firstVariant.click(); }, 1);
13+
}
14+
}
15+
16+
function onSelection(event) {
17+
document.getElementById(`selected-${event.target.name}`).innerText = event.target.dataset.presentation;
18+
19+
const optionIndex = event.target.attributes["data-option-index"].value;
20+
const nextType = document.querySelector(`[data-option-index="${parseInt(optionIndex, 10) + 1}"]`);
21+
if (nextType) {
22+
updateOptions(nextType.name, optionIndex);
23+
}
24+
selectVariant();
25+
}
26+
27+
function updateStockView(status) {
28+
if (status) {
29+
this.stockIndicatorTarget.classList.add("d-hide");
30+
this.cartButtonTarget.disabled = false;
31+
} else {
32+
this.stockIndicatorTarget.classList.remove("d-hide");
33+
this.cartButtonTarget.disabled = true;
34+
}
35+
}
36+
37+
function updateOptions(nextTypeName, optionIndex) {
38+
const nextOptionValues = this.nextOptionValues(optionIndex);
39+
40+
let firstRadio = null;
41+
const allNextOptions = [...document.querySelectorAll(`[name="${nextTypeName}"]`)];
42+
allNextOptions.forEach((radio) => {
43+
if (!nextOptionValues.includes(parseInt(radio.value, 10))) {
44+
radio.disabled = true;
45+
radio.parentElement.classList.add("d-hide");
46+
} else {
47+
radio.disabled = false;
48+
radio.parentElement.classList.remove("d-hide");
49+
if (!firstRadio) { firstRadio = radio; }
50+
}
51+
});
52+
53+
const nextSelectedRadio = document.querySelector(`[name="${nextTypeName}"]:checked`);
54+
if (nextSelectedRadio.disabled) {
55+
firstRadio.click();
56+
} else {
57+
nextSelectedRadio.click();
58+
}
59+
}
60+
61+
function nextOptionValues(optionIndex) {
62+
const values = [];
63+
const variantOptionsTargets = document.querySelectorAll('.product-variants__list > li > input');
64+
variantOptionsTargets.forEach((option) => {
65+
const optionValueIds = JSON.parse(option.attributes["data-option-value-ids"].value);
66+
const selectedOptionIds = this.currentSelection();
67+
let matched = true;
68+
for (let i = 0; i <= optionIndex; i += 1) {
69+
if (optionValueIds[i] !== selectedOptionIds[i]) {
70+
matched = false;
71+
break;
72+
}
73+
}
74+
if (matched) {
75+
values.push(optionValueIds[parseInt(optionIndex, 10) + 1]);
76+
}
77+
});
78+
return values;
79+
}
80+
81+
function updateView(variant) {
82+
document.querySelector('#product-price').innerHTML = variant.dataset.price;
83+
}
84+
85+
function selectVariant() {
86+
this.variant = document.querySelector(`[data-option-value-ids="${JSON.stringify(this.currentSelection())}"]`);
87+
if (this.variant) {
88+
this.variant.checked = true;
89+
this.updateView(this.variant);
90+
} else {
91+
this.priceTarget.innerText = "Not found, please select all optionTypeSelector";
92+
}
93+
}
94+
95+
function currentSelection() {
96+
let i = 0;
97+
const selectionArr = [];
98+
while (document.querySelector(`[data-option-index="${i}"]`)) {
99+
selectionArr.push(parseInt(document.querySelector(`[data-option-index="${i}"]:checked`).value, 10));
100+
i += 1;
101+
}
102+
return selectionArr;
103+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@import "../../variables";
2+
3+
.button {
4+
text-decoration:none;
5+
display: inline-block;
6+
transition: all .3 ease;
7+
cursor: pointer;
8+
}
9+
10+
.button-secondary {
11+
background: $color-dark;
12+
color: $color-white;
13+
border-radius: 100px;
14+
border: 0;
15+
margin-top: 4rem;
16+
padding: 1.5rem 3.5rem;
17+
text-transform: uppercase;
18+
font-size: 1.8rem;
19+
font-size: clamp(1.8rem, 2vw, 2.2rem);
20+
21+
&:hover,
22+
&:focus {
23+
background: $color-white;
24+
color: $color-dark;
25+
}
26+
}
27+
28+
.button-tertiary {
29+
background: $color-blue;
30+
color: $color-white;
31+
text-transform: uppercase;
32+
padding: 1.5rem 2.5rem;
33+
border-radius: 50px;
34+
border: 0;
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@import "../../variables";
2+
3+
.cart-footer {
4+
flex-direction: column;
5+
align-items: flex-end;
6+
7+
@media (min-width: 900px) {
8+
margin-top: 105px;
9+
}
10+
11+
& > * {
12+
flex-grow: 1;
13+
}
14+
15+
&__total {
16+
text-align: center;
17+
display: flex;
18+
align-items: center;
19+
justify-content: space-between;
20+
21+
& > strong {
22+
padding-left: 1rem;
23+
}
24+
25+
@media (min-width: 900px) {
26+
min-width: 286px;
27+
}
28+
}
29+
30+
&__primary-action {
31+
padding: 3rem 0 0 0;
32+
min-width: 100%;
33+
34+
@media (min-width: 900px) {
35+
min-width: 286px;
36+
}
37+
38+
button {
39+
width: 100%;
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
@import "../../variables";
2+
3+
.cart-items {
4+
&-header {
5+
display: none;
6+
7+
@media (min-width: 900px) {
8+
align-items: center;
9+
display: flex;
10+
border-bottom: 1px solid $color-gray-light;
11+
}
12+
13+
&__title {
14+
font-size: 1.3rem;
15+
font-weight: $font-weight-bold;
16+
text-transform: uppercase;
17+
}
18+
19+
& > * {
20+
flex-grow: 0;
21+
flex-shrink: 0;
22+
23+
&:nth-child(2) {
24+
padding: 0 4rem 0 4rem;
25+
}
26+
27+
&:nth-child(3),
28+
&:last-child {
29+
@media (min-width: 900px){
30+
padding: 0 4rem 0 0;
31+
}
32+
}
33+
34+
&:first-child {
35+
@media (min-width: 900px){
36+
width: 55%;
37+
}
38+
}
39+
}
40+
}
41+
}
42+
43+
.cart-item {
44+
display: grid;
45+
grid-template-columns: repeat(3, 1fr);
46+
grid-column-gap: 2rem;
47+
align-items: center;
48+
49+
@media (min-width: 600px) {
50+
display: flex;
51+
}
52+
}
53+
54+
.cart-item__quantity,
55+
.cart-item__price,
56+
.cart-item__remove {
57+
text-align: left;
58+
width: auto;
59+
margin: 10px 0 10px 0;
60+
61+
@media (min-width: 900px) {
62+
width: 8rem;
63+
text-align: right;
64+
margin: 10px 0 10px auto;
65+
}
66+
}
67+
68+
.cart-item__price-single,
69+
.cart-item__price {
70+
@media (min-width: 900px) {
71+
padding: 0 4rem 0;
72+
}
73+
}
74+
75+
.cart-item__remove {
76+
.delete {
77+
width: 26px;
78+
height: 26px;
79+
color: transparent;
80+
background: asset_data_url("icon-delete.svg") no-repeat;
81+
background-size: 100% auto;
82+
background-position: center;
83+
}
84+
}
85+
86+
.cart-item__image img {
87+
max-width: 100%;
88+
height: auto;
89+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@import "../../variables";
2+
3+
.cart-link {
4+
padding: 5px;
5+
}
6+
7+
.cart-info {
8+
display: inline-block;
9+
width: 32px;
10+
height: 32px;
11+
background: asset_data_url("icon-shopping-cart.svg") no-repeat;
12+
background-size: 100% auto;
13+
background-position: bottom;
14+
position: relative;
15+
16+
.link-text {
17+
color: $color-white;
18+
background: $color-blue;
19+
font-weight: $font-weight-bold;
20+
border-radius: 50px;
21+
font-size: $font-size-base / 1.2;
22+
text-align: center;
23+
position: absolute;
24+
top: -5px;
25+
right: -5px;
26+
width: 22px;
27+
height: 22px;
28+
line-height: 22px;
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@import "../../variables";
2+
3+
.cart-page {
4+
@media (min-width: 900px) {
5+
padding-bottom: 18rem;
6+
}
7+
8+
&__coupon-code {
9+
justify-content: center;
10+
11+
@media (min-width: 900px) {
12+
margin-top: 0;
13+
max-width: 286px;
14+
justify-content: flex-end;
15+
}
16+
}
17+
18+
&__other-actions {
19+
align-items: center;
20+
flex-direction: column;
21+
display: flex;
22+
23+
@media (min-width: 900px) {
24+
background: #FBFAFA;
25+
padding: 2rem 1rem;
26+
flex-direction: row;
27+
justify-content: space-between;
28+
margin-top: -230px;
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)