Skip to content

Commit b1c27cc

Browse files
authored
Vouchers block. Adding helper styles (#2)
* Vouchers block. Adding helper styles
1 parent ff53ea3 commit b1c27cc

File tree

5 files changed

+753
-35
lines changed

5 files changed

+753
-35
lines changed

blocks/fixed-background/fixed-background.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

blocks/fixed-background/fixed-background.js

Whitespace-only changes.

blocks/vouchers/vouchers.css

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
.vouchers {
2+
display: grid;
3+
grid-template-columns: repeat(3, 1fr);
4+
gap: 60px 24px;
5+
padding-block: 40px 20px;
6+
max-width: min(var(--page-max-width), 100% - var(--page-padding));
7+
width: fit-content;
8+
margin: auto;
9+
10+
@media (width <= 1024px) {
11+
grid-template-columns: repeat(5, 1fr);
12+
gap: 30px 16px;
13+
overflow-x: scroll;
14+
width: 100%;
15+
max-width: unset;
16+
padding-inline: var(--page-padding) calc(var(--page-padding) + 48px);
17+
}
18+
19+
@media (width <= 1024px) {
20+
& >*:nth-child(n+6):nth-child(-n+10) {
21+
translate:48px
22+
}
23+
}
24+
25+
.voucher-item {
26+
--opacity: 1;
27+
--bg: var(--clr-css-pink);
28+
--bg-hover: var(--clr-css-pink-1);
29+
--shadow-y: 10px;
30+
--shadow-blur: 12px;
31+
32+
color: #fff;
33+
min-width: 212px;
34+
max-width: 340px;
35+
position: relative;
36+
display: flex;
37+
justify-content: center;
38+
align-items: center;
39+
font-size: var(--font-voucher);
40+
font-weight: 300;
41+
text-align: center;
42+
transform: rotate(0);
43+
transition: translate .2s, scale .2s;
44+
pointer-events: none;
45+
46+
@media (width <= 1024px) {
47+
min-height: 130px;
48+
width: 212px;
49+
}
50+
51+
&::before,
52+
&::after {
53+
--rotation: -4deg;
54+
55+
position: absolute;
56+
content: "";
57+
background: none;
58+
box-shadow: 0 var(--shadow-y) var(--shadow-blur) #00000080;
59+
height: 10px;
60+
left: 12px;
61+
bottom: 12px;
62+
width: 50%;
63+
z-index: -1;
64+
transform: skew(var(--rotation)) rotate(var(--rotation));
65+
66+
@media (width <= 1024px) {
67+
--rotation: -6deg;
68+
}
69+
}
70+
71+
&::after {
72+
--rotation: 4deg;
73+
74+
left: auto;
75+
right: 12px;
76+
}
77+
78+
.voucher-svg {
79+
position: relative;
80+
max-height: fit-content;
81+
height: auto;
82+
filter: drop-shadow(0 4px 4px rgb(0 0 0 / 25%));
83+
84+
.voucher-svg-bg-color {
85+
fill: var(--bg);
86+
}
87+
88+
.vocuher-svg-bg-pattern {
89+
opacity: var(--opacity);
90+
}
91+
}
92+
}
93+
94+
.voucher-item-pink {
95+
--bg: var(--clr-css-pink);
96+
--bg-hover: var(--clr-css-pink-1);
97+
--opacity: .1
98+
}
99+
100+
.voucher-item-yellow {
101+
--bg: var(--clr-css-yellow);
102+
--bg-hover: var(--clr-css-yellow-1);
103+
--opacity: .2
104+
}
105+
106+
.voucher-item-green {
107+
--bg: var(--clr-css-green);
108+
--bg-hover: var(--clr-css-green-1);
109+
--opacity: .1
110+
}
111+
112+
.voucher-item-white {
113+
--bg: var(--clr-css-beige);
114+
--bg-hover: var(--clr-css-beige-1);
115+
--opacity: 0.8;
116+
117+
color: var(--clr-css-cyan);
118+
}
119+
120+
.voucher-item-rotate-l {
121+
transform: rotate(-3deg)
122+
}
123+
124+
.voucher-item-rotate-r {
125+
transform: rotate(3deg)
126+
}
127+
128+
.voucher-item-text {
129+
position: absolute;
130+
width: calc(100% - 1em);
131+
}
132+
133+
.voucher-item-text-original {
134+
position: relative;
135+
top: 0;
136+
display: block;
137+
filter: blur(0);
138+
opacity: 1;
139+
transition: filter .3s, opacity .3s;
140+
}
141+
142+
.voucher-item-text-hover {
143+
position: absolute;
144+
display: block;
145+
width: 100%;
146+
top: 50%;
147+
transform: translateY(-50%);
148+
opacity: 0;
149+
filter: blur(3px);
150+
scale: .7;
151+
transition: filter .3s, opacity .3s, scale .3s;
152+
}
153+
154+
.voucher-link:hover {
155+
.voucher-item {
156+
--shadow-y: 13px;
157+
--shadow-blur: 14px;
158+
159+
translate: 0 -2px;
160+
scale: 1.005;
161+
}
162+
163+
.voucher-item-text-original {
164+
opacity: 0;
165+
filter: blur(3px);
166+
}
167+
168+
.voucher-item-text-hover {
169+
opacity: 1;
170+
filter: blur(0);
171+
scale: 1;
172+
}
173+
}
174+
}

blocks/vouchers/vouchers.js

Lines changed: 529 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

styles/styles.css

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ p+p {
187187
margin-top: 2rem;
188188
}
189189

190-
191-
main > div {
192-
margin: 40px 16px;
190+
strong {
191+
font-weight: 600;
193192
}
194193

195194
input,
@@ -199,6 +198,50 @@ button {
199198
font: inherit;
200199
}
201200

201+
.text-center {
202+
text-align: center;
203+
}
204+
205+
.text-right {
206+
text-align: right;
207+
}
208+
209+
.text-huge * {
210+
font-size: var(--font-huge);
211+
}
212+
213+
.text-big * {
214+
font-size: var(--font-big);
215+
}
216+
217+
.space-small {
218+
margin-bottom: var(--space-small);
219+
}
220+
221+
.space-medium {
222+
margin-bottom: var(--space-medium);
223+
}
224+
225+
.space-large {
226+
margin-bottom: var(--space-large);
227+
}
228+
229+
.text {
230+
margin-inline: auto;
231+
max-width: min(940px, 80%);
232+
width: min(var(--page-max-width), 100% - 2* var(--page-padding));
233+
234+
@media (width <= 667px) {
235+
max-width: unset;
236+
}
237+
}
238+
239+
.media {
240+
margin-inline: auto;
241+
max-width: 940px;
242+
width: min(var(--page-max-width), 100% - 2* var(--page-padding));
243+
}
244+
202245
/* links */
203246
a:any-link {
204247
color: var(--link-color);
@@ -240,6 +283,10 @@ button:focus {
240283
box-shadow: 0 0 0 .125rem var(--clr-css-blue-1);
241284
}
242285

286+
main {
287+
min-height: 100vh;
288+
}
289+
243290
main img {
244291
max-width: 100%;
245292
width: auto;
@@ -256,24 +303,3 @@ main img {
256303
height: 100%;
257304
width: 100%;
258305
}
259-
260-
/* sections */
261-
main > .section {
262-
margin: 40px 0;
263-
}
264-
265-
main > .section > div {
266-
max-width: 1200px;
267-
margin: auto;
268-
padding: 0 24px;
269-
}
270-
271-
main > .section:first-of-type {
272-
margin-top: 0;
273-
}
274-
275-
@media (width >= 900px) {
276-
main > .section > div {
277-
padding: 0 32px;
278-
}
279-
}

0 commit comments

Comments
 (0)