| 1 |
@import '../../styles/skeleton'; |
| 2 |
|
| 3 |
/* |
| 4 |
* Host pages do not load the design system foundation stylesheet (only the form inside the |
| 5 |
* iframe does), so the values here are self-contained. The spinner accent follows the same |
| 6 |
* --givewp-primary-color the launcher buttons use. |
| 7 |
*/ |
| 8 |
.givewp-embed-frame { |
| 9 |
position: relative; |
| 10 |
|
| 11 |
&[data-state='loading']='loading'], |
| 12 |
&[data-state='slow']='slow'] { |
| 13 |
min-height: 20rem; |
| 14 |
} |
| 15 |
|
| 16 |
&__loading { |
| 17 |
position: absolute; |
| 18 |
inset: 0; |
| 19 |
display: flex; |
| 20 |
align-items: center; |
| 21 |
justify-content: center; |
| 22 |
} |
| 23 |
|
| 24 |
&__spinner { |
| 25 |
width: 2.5rem; |
| 26 |
height: 2.5rem; |
| 27 |
border-radius: 50%; |
| 28 |
border: 3px solid rgba(0, 0, 0, 0.12); |
| 29 |
border-top-color: var(--givewp-primary-color, rgba(0, 0, 0, 0.55)); |
| 30 |
animation: givewp-embed-frame-spin 0.8s linear infinite; |
| 31 |
} |
| 32 |
|
| 33 |
/* |
| 34 |
* A skeleton sits in normal flow and sets the frame's height itself; the spinner keeps the |
| 35 |
* absolute, centered layout above. |
| 36 |
*/ |
| 37 |
&[data-placeholder='skeleton']='skeleton'] &__loading { |
| 38 |
position: static; |
| 39 |
display: block; |
| 40 |
/* The skeleton's container queries resolve against this box, the same width as the iframe. */ |
| 41 |
container-type: inline-size; |
| 42 |
} |
| 43 |
|
| 44 |
&__iframe { |
| 45 |
width: 1px; |
| 46 |
min-width: 100%; |
| 47 |
border: 0; |
| 48 |
visibility: hidden; |
| 49 |
opacity: 0; |
| 50 |
transition: opacity 0.2s ease; |
| 51 |
} |
| 52 |
|
| 53 |
/* Until the handshake the iframe's default height must not add to the placeholder's. */ |
| 54 |
&[data-state='loading']='loading'] &__iframe, |
| 55 |
&[data-state='slow']='slow'] &__iframe { |
| 56 |
position: absolute; |
| 57 |
top: 0; |
| 58 |
left: 0; |
| 59 |
} |
| 60 |
|
| 61 |
&[data-state='ready']='ready'] &__iframe { |
| 62 |
visibility: visible; |
| 63 |
opacity: 1; |
| 64 |
} |
| 65 |
|
| 66 |
/* |
| 67 |
* Overlays the placeholder rather than sitting under it: a skeleton can be taller than the |
| 68 |
* viewport, so anything below it lands below the fold where nobody scrolls to it. |
| 69 |
*/ |
| 70 |
&__fallback { |
| 71 |
position: absolute; |
| 72 |
z-index: 1; |
| 73 |
margin: 0; |
| 74 |
text-align: center; |
| 75 |
animation: givewp-embed-frame-fade-in 0.3s ease; |
| 76 |
|
| 77 |
/* The donate-button stylesheet styles the link as a pill, so give it its own centered line. */ |
| 78 |
a { |
| 79 |
display: block; |
| 80 |
width: fit-content; |
| 81 |
margin: 0.75rem auto 0; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
/* The spinner is short and centered, so the message fits along the bottom of the frame. */ |
| 86 |
&[data-placeholder='spinner']='spinner'] &__fallback { |
| 87 |
inset: auto 0 1rem; |
| 88 |
} |
| 89 |
|
| 90 |
/* Over a skeleton the message becomes a card at the top edge, where the viewer already is. */ |
| 91 |
&[data-placeholder='skeleton']='skeleton'] &__fallback { |
| 92 |
top: 1rem; |
| 93 |
left: 50%; |
| 94 |
box-sizing: border-box; |
| 95 |
/* With `left: 50%` the shrink-to-fit space is half the frame, so size to the text and let |
| 96 |
the cap do the wrapping. */ |
| 97 |
width: max-content; |
| 98 |
max-width: min(28rem, calc(100% - 2rem)); |
| 99 |
padding: 1rem 1.5rem; |
| 100 |
background-color: #fff; |
| 101 |
border: 1px solid rgba(0, 0, 0, 0.08); |
| 102 |
border-radius: 0.5rem; |
| 103 |
box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15); |
| 104 |
transform: translateX(-50%); |
| 105 |
} |
| 106 |
} |
| 107 |
|
| 108 |
@keyframes givewp-embed-frame-spin { |
| 109 |
to { |
| 110 |
transform: rotate(360deg); |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
@keyframes givewp-embed-frame-fade-in { |
| 115 |
from { |
| 116 |
opacity: 0; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
@media (prefers-reduced-motion: reduce) { |
| 121 |
.givewp-embed-frame__iframe { |
| 122 |
transition: none; |
| 123 |
} |
| 124 |
|
| 125 |
.givewp-embed-frame__spinner, |
| 126 |
.givewp-embed-frame__fallback { |
| 127 |
animation: none; |
| 128 |
} |
| 129 |
} |
| 130 |
|