Skip to content

Commit 8e96f68

Browse files
authored
fix(widget): viewport height responsiveness (#434)
1 parent a7a23ab commit 8e96f68

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

components/src/widget/views/interaction/interaction.css

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
:host {
22
display: flex;
33
flex-direction: column;
4-
flex: 1 1 0%;
5-
min-height: 0;
4+
flex: 1 1 auto;
65
--wm-button-radius: 8px;
76
font-family: var(--wm-font-family, system-ui, sans-serif);
87
}
@@ -42,12 +41,12 @@
4241
display: flex;
4342
flex-direction: column;
4443
align-items: center;
45-
justify-content: space-between;
46-
margin-top: var(--Spacings-lg, 24px);
44+
justify-content: center;
45+
flex: 1;
4746
}
4847

4948
.interaction-body img {
50-
margin-top: var(--Spacings-2xl, 32px);
49+
margin-top: var(--Spacings-lg, 24px);
5150
}
5251

5352
.title {
@@ -89,7 +88,7 @@
8988
flex-direction: column;
9089
align-items: center;
9190
width: 100%;
92-
margin-top: auto;
91+
margin-top: var(--Spacings-lg, 24px);
9392
cursor: pointer;
9493
}
9594

components/src/widget/views/interaction/interaction.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ export class PaymentInteraction extends LitElement {
249249
</div>
250250
<img
251251
src=${loadingIcon}
252-
width="122px"
253-
height="200px"
252+
width="122"
253+
height="200"
254254
alt="Payment authorization in progress"
255255
/>
256256
</div>
@@ -274,8 +274,8 @@ export class PaymentInteraction extends LitElement {
274274
</div>
275275
<img
276276
src=${successIcon}
277-
width="122px"
278-
height="200px"
277+
width="122"
278+
height="200"
279279
alt="Payment successful"
280280
/>
281281
</div>
@@ -296,8 +296,8 @@ export class PaymentInteraction extends LitElement {
296296
<div class="title failed">${this.errorMessage}</div>
297297
<img
298298
src=${failedIcon}
299-
width="122px"
300-
height="200px"
299+
width="122"
300+
height="200"
301301
alt="Payment failed"
302302
/>
303303
</div>

components/src/widget/widget.css

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050

5151
--wm-widget-trigger-bg-color: #f3f4f6;
5252
--wm-button-text-color: var(--Colors-white);
53+
54+
--trigger-button-height: 3.5rem;
55+
--trigger-button-width: 3.5rem;
56+
--top-edge-margin: 6.25rem;
5357
}
5458

5559
button,
@@ -110,11 +114,14 @@ a:focus-visible {
110114
visibility: visible;
111115
width: 340px;
112116
height: 606px;
117+
max-height: calc(
118+
100vh - var(--trigger-button-height) - var(--top-edge-margin)
119+
);
120+
overflow-y: auto;
113121
transition:
114122
opacity 0.25s ease-out,
115123
transform 0.25s ease-out,
116124
visibility 0s linear 0s;
117-
overflow: auto;
118125
}
119126

120127
.content.closed {
@@ -131,8 +138,8 @@ a:focus-visible {
131138
.trigger {
132139
cursor: pointer;
133140
background: var(--wm-widget-trigger-bg-color);
134-
width: 3.5rem;
135-
height: 3.5rem;
141+
width: var(--trigger-button-width);
142+
height: var(--trigger-button-height);
136143
display: flex;
137144
align-items: center;
138145
justify-content: center;
@@ -295,6 +302,12 @@ a:focus-visible {
295302
align-self: stretch;
296303
}
297304

305+
.divider {
306+
width: 100%;
307+
height: 1px;
308+
margin: var(--Spacings-lg, 24px) 0;
309+
}
310+
298311
.form-label {
299312
display: flex;
300313
justify-content: flex-start;
@@ -463,7 +476,7 @@ a:focus-visible {
463476
}
464477
}
465478

466-
@media (max-width: 480px), (max-height: 768px) {
479+
@media (max-width: 480px) {
467480
.content.open:not(.preview-mode) {
468481
position: fixed;
469482
top: 0;
@@ -475,7 +488,7 @@ a:focus-visible {
475488
}
476489
}
477490

478-
@container (max-width: 320px) {
491+
@container (max-width: 340px) {
479492
.content.open.preview-mode {
480493
position: absolute;
481494
inset: 0;

components/src/widget/widget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class PaymentWidget extends LitElement {
151151
const showDescription = this.config.isWidgetDescriptionVisible ?? true
152152
const descriptionElement = showDescription
153153
? html`<p>${description}</p>`
154-
: null
154+
: html`<div class="divider" />`
155155

156156
return html`
157157
<div class="widget-header-container">

0 commit comments

Comments
 (0)