Skip to content

Commit 6690b28

Browse files
committed
New block: Testimonial
1 parent b1c27cc commit 6690b28

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

blocks/testimonial/testimonial.css

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
.testimonial {
2+
.testimonial-item {
3+
--page-padding: 50px;
4+
5+
width: min(var(--page-max-width), 100% - 2* var(--page-padding));
6+
margin-inline: auto;
7+
max-width: min(1136px, 90%);
8+
padding-left: 50px;
9+
box-shadow: rgb(0 0 0 / 25%) 0 16px 21.7px;
10+
display: flex;
11+
flex-wrap: wrap;
12+
background: url("../../img/bg-card-box.jpg") 0 0 / 100% 100% no-repeat;
13+
border-radius: 10px;
14+
15+
@media (width <= 1024px) {
16+
flex-direction: column-reverse;
17+
gap: 24px;
18+
padding: 24px 16px 32px;
19+
}
20+
21+
@media (width <= 667px) {
22+
--page-padding: 12px;
23+
24+
max-width: unset;
25+
}
26+
27+
> div:first-child {
28+
width: 53%;
29+
padding-right: 5%;
30+
padding-top: 30px;
31+
padding-bottom: 30px;
32+
line-height: 1;
33+
34+
@media (width <= 1024px) {
35+
width: unset;
36+
padding: 0;
37+
line-height: 1.2;
38+
}
39+
40+
h3 {
41+
font-size: var(--font-h3);
42+
font-weight: inherit;
43+
line-height: 1.2;
44+
margin-block: 0.3em;
45+
}
46+
47+
p {
48+
font-size: var(--font-rte-small);
49+
line-height: 24px;
50+
margin-top: 1em;
51+
}
52+
53+
p+p {
54+
margin-top: 2rem;
55+
56+
@media (width <= 1024px) {
57+
text-align: center;
58+
}
59+
}
60+
61+
.button {
62+
line-height: 1;
63+
}
64+
}
65+
66+
> div:last-child {
67+
width: 38%;
68+
margin-top: -36px;
69+
margin-bottom: -24px;
70+
position: relative;
71+
left: calc(-210px + min(20vw, 288px));
72+
73+
@media (width <= 1024px) {
74+
width: fit-content;
75+
margin: 0 auto;
76+
left: unset;
77+
padding-inline: 32px;
78+
}
79+
80+
picture {
81+
display: flex;
82+
max-width: 100%;
83+
object-fit: cover;
84+
}
85+
86+
img {
87+
position: absolute;
88+
max-height: min(100%, 474px);
89+
max-width: 474px;
90+
height: auto;
91+
width: auto;
92+
aspect-ratio: 1 / 1;
93+
box-shadow: rgb(0 0 0 / 15%) 0 8px 12px 6px, rgb(0 0 0 / 30%) 0 4px 4px;
94+
border-radius: 100%;
95+
96+
@media (width <= 1024px) {
97+
position: static;
98+
max-width: min(100%, 300px);
99+
max-height: min(100%, 300px);
100+
margin-inline: auto;
101+
box-shadow: none;
102+
}
103+
}
104+
}
105+
}
106+
}

blocks/testimonial/testimonial.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default function decorate(block) {
2+
[...block.children].forEach((row) => {
3+
row.classList.add('testimonial-item');
4+
5+
row.querySelectorAll('a').forEach((a) => {
6+
const link = a.href;
7+
8+
if (!link.startsWith(window.location.origin)) {
9+
a.setAttribute('target', '_blank');
10+
a.setAttribute('rel', 'noopener noreferrer');
11+
}
12+
});
13+
});
14+
}

img/bg-card-box.jpg

89.7 KB
Loading

0 commit comments

Comments
 (0)