Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/src/assets/wm_close_button.svg

This file was deleted.

2 changes: 1 addition & 1 deletion components/src/assets/wm_wallet_totem.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions components/src/shared/components/close-btn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { LitElement, css, html } from 'lit'
import { property } from 'lit/decorators.js'

export class CloseBtn extends LitElement {
@property({ type: String }) color: string = 'currentColor'
@property({ type: String }) label: string = 'Close window'

static styles = css`
button {
border: none;
background: none;
cursor: pointer;
padding: 0px;
border-radius: 8px;
width: 25px;
height: 25px;
aspect-ratio: 1/1;
}

button:hover {
border-radius: 8px;
background-color: rgba(0, 0, 0, 0.05);
}
`

render() {
return html` <button aria-label=${this.label}>
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true">
<path
d="M5.33219 15.2575L4.74219 14.6675L9.40885 10.0008L4.74219 5.33414L5.33219 4.74414L9.99885 9.41081L14.6655 4.74414L15.2555 5.33414L10.5889 10.0008L15.2555 14.6675L14.6655 15.2575L9.99885 10.5908L5.33219 15.2575Z"
fill=${this.color}
/>
</svg>
</button>`
}
}
75 changes: 75 additions & 0 deletions components/src/shared/components/dots-loader.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import { LitElement, html, css } from 'lit'

export class DotsLoader extends LitElement {
static styles = css`
:host {
display: inline-flex;
gap: 6px;
align-items: flex-end;
height: 20px;
}

span {
width: 8px;
height: 8px;
border-radius: 50%;
/* Resolves to white or black based on --primary-color lightness.
* Uses oklch instead of contrast-color(). contrast-color is unsupported in Chrome,
* and has issues inside custom elements (shadow DOM) even where partially supported.
* Reference: https://css-tricks.com/approximating-contrast-color-with-other-css-features/ */
background-color: oklch(from var(--primary-color) round(1.21 - L) 0 0);
animation: circles-bounce 500ms infinite ease-in alternate;
}

span:nth-child(2) {
animation-delay: 150ms;
}

span:nth-child(3) {
animation-delay: 300ms;
}

span:nth-child(4) {
animation-delay: 450ms;
}

@keyframes circles-bounce {
0% {
transform: translateY(0);
}
100% {
transform: translateY(-10px);
}
}

@media (prefers-reduced-motion: reduce) {
:host {
align-items: center;
}

span {
animation-name: circles-fade;
}

@keyframes circles-fade {
0% {
opacity: 1;
}
100% {
opacity: 0.2;
}
}
}
`

render() {
return html`
<span role="status" aria-label="Loading" style="display:contents">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</span>
`
}
}
61 changes: 27 additions & 34 deletions components/src/widget/views/confirmation/confirmation.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
:host {
font-family: var(--wm-font-family, system-ui, sans-serif);
display: flex;
flex: 1;

--primary-color: var(--wm-primary-color, #56b7b5);
--background-color: var(--wm-background-color, #ffffff);
Expand Down Expand Up @@ -45,25 +47,6 @@
color: var(--Colors-white, #ffffff);
}

.close-button {
cursor: pointer;
width: 20px;
height: 20px;
flex-shrink: 0;
aspect-ratio: 1/1;
background: none;
border: none;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.2s ease;
}

.close-button:hover {
background-color: rgba(0, 0, 0, 0.05);
}

.confirmation-buttons-header {
color: var(--primary-color, #7469a8);
font-family: var(--Font-Family-Inter, Inter);
Expand Down Expand Up @@ -112,22 +95,28 @@
align-items: center;
gap: 10px;
border-radius: 100px;
border: 1px solid var(--Colors-silver-300, #c9c9c9);
background: var(--Colors-white, #ffffff);
color: var(--Colors-silver-700, #7b7b7b);
border: 1px solid var(--text-color, #c9c9c9);

background: var(--background-color, #f2fbf9);
color: var(--Text-paragraph-standard, #7b7b7b);
font-family: var(--Font-Family-Inter, Inter);
font-size: var(--Font-Size-text-base, 16px);
font-style: normal;
font-weight: var(--Font-Weight-Bold, 700);
line-height: var(--Font-Line-Height-md, 24px);
}

.preset-btn:hover,
.preset-btn:hover {
background: #0000002f;
}

.preset-btn.selected {
background: var(--primary-color);
color: var(--Colors-white, #ffffff);
opacity: 0.9;
border: 1px solid var(--primary-color);
background: color-mix(
in srgb,
var(--primary-color, #f2fbf9) 45%,
transparent
);
border: 1px solid var(--primary-color, #5b5380);
}

.widget-body p,
Expand Down Expand Up @@ -169,8 +158,12 @@
gap: 10px;
align-self: stretch;
border-radius: 8px;
border: 1px solid var(--Colors-green-200, #abe4df);
background: var(--Colors-mint-50, #f2fbf9);
border: 1px solid var(--primary-color, #abe4df);
background: color-mix(
in srgb,
var(--primary-color, #f2fbf9) 20%,
transparent
);
min-height: 80px;
}

Expand Down Expand Up @@ -202,9 +195,9 @@
}

.summary-value {
color: var(--primary-color);
color: var(--primary-color, #363636);
font-family: var(--Font-Family-Inter, Inter);
font-size: var(--Font-Size-text-base, 16px);
font-size: 16px;
font-style: normal;
font-weight: var(--Font-Weight-Bold, 700);
line-height: var(--Font-Line-Height-md, 24px);
Expand Down Expand Up @@ -259,7 +252,7 @@
display: flex;
align-items: center;
justify-content: center;
margin-top: 16px;
margin-top: auto;

background: var(--primary-color);
}
Expand All @@ -282,7 +275,6 @@
justify-content: center;
gap: var(--Spacings-sm, 8px);
color: var(--Text-paragraph-standard, #363636);
opacity: 0.6;
}

.loader {
Expand Down Expand Up @@ -382,6 +374,7 @@

.form-input.with-currency {
padding-left: calc(var(--Font-Size-text-base) + 2rem);
border: 2px solid var(--Colors-silver-300, #c9c9c9);
}

.form-input,
Expand All @@ -390,7 +383,7 @@
height: 48px;
padding: var(--Spacings-md, 12px);
border: 1px solid var(--Colors-silver-300, #c9c9c9);
border-radius: var(--Radius-Moderate-rounding, 8px);
border-radius: var(--Radius-Moderate-rounding, 0.75rem);
font-family: var(--Font-Family-Inter, Inter);
font-size: var(--Font-Size-text-base, 16px);
font-style: normal;
Expand Down
24 changes: 14 additions & 10 deletions components/src/widget/views/confirmation/confirmation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { LitElement, html, unsafeCSS } from 'lit'
import { property, state } from 'lit/decorators.js'
import type { PaymentGrantInput, PaymentQuoteInput } from 'publisher-tools-api'
import { CloseBtn } from '@c/shared/components/close-btn'
import { DotsLoader } from '@c/shared/components/dots-loader'
import { getCurrencySymbol, getFormattedAmount } from '@c/utils'
import type {
Quote,
Expand Down Expand Up @@ -32,6 +34,13 @@ export class PaymentConfirmation extends LitElement {

connectedCallback() {
super.connectedCallback()
if (!customElements.get('wm-dots-loader')) {
customElements.define('wm-dots-loader', DotsLoader)
}
if (!customElements.get('wm-close-btn')) {
customElements.define('wm-close-btn', CloseBtn)
}

this.updateComplete.then(() => {
const input =
this.shadowRoot?.querySelector<HTMLInputElement>('#amount-input')
Expand Down Expand Up @@ -324,14 +333,10 @@ export class PaymentConfirmation extends LitElement {
</svg>
<span>back</span>
</button>
<button class="close-button" @click=${this.closeWidget}>
<svg fill="none" viewBox="0 0 20 20">
<path
fill="var(--wm-primary-color, #8075B3)"
d="m5.332 15.257-.59-.59L9.41 10 4.742 5.333l.59-.59L10 9.41l4.666-4.667.59.59L10.59 10l4.666 4.667-.59.59L10 10.59l-4.667 4.667Z"
/>
</svg>
</button>
<wm-close-btn
@click=${this.closeWidget}
.color=${this.configController.config.profile.color.theme}
></wm-close-btn>
</div>

<div class="widget-body">
Expand Down Expand Up @@ -399,8 +404,7 @@ export class PaymentConfirmation extends LitElement {
return html`
<div class="payment-details">
<div class="loading-state">
<span class="loader"></span>
<span>Loading payment details...</span>
<wm-dots-loader></wm-dots-loader>
</div>
</div>
`
Expand Down
Loading
Loading