Skip to content

Commit 42c3a88

Browse files
committed
Improve sponsor ad hover layout
1 parent 36c997b commit 42c3a88

1 file changed

Lines changed: 41 additions & 25 deletions

File tree

theme/pagetoc.css

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
padding: 5px;
128128
display: none; /*changed via JS once ad is loaded*/
129129
flex-direction: column;
130+
align-items: center;
130131
text-decoration: none !important;
131132
overflow: hidden;
132133
backdrop-filter: blur(6px);
@@ -141,27 +142,31 @@
141142
object-fit: contain;
142143
align-self: center;
143144
flex: 0 0 auto;
144-
transition-property: all;
145-
transition-timing-function: cubic-bezier(.4,0,.2,1);
146-
transition-duration: .3s;
145+
transition:
146+
height .36s cubic-bezier(.22,1,.36,1),
147+
width .36s cubic-bezier(.22,1,.36,1),
148+
max-height .36s cubic-bezier(.22,1,.36,1),
149+
min-height .36s cubic-bezier(.22,1,.36,1),
150+
padding .36s cubic-bezier(.22,1,.36,1),
151+
transform .36s cubic-bezier(.22,1,.36,1);
147152
}
148153
.sidesponsor:hover img{
149-
width: 42px;
154+
width: 56px;
150155
padding: 4px;
151156
grid-area: sponsor-image;
152157
align-self: center;
153-
transition-duration: 0s;
158+
justify-self: center;
154159
}
155160
.sidesponsor:hover {
156161
display: grid !important;
157-
grid-template-columns: auto minmax(0, 1fr);
158-
grid-template-rows: max-content minmax(0, 1fr) auto;
162+
grid-template-columns: minmax(0, 1fr);
163+
grid-template-rows: max-content max-content minmax(0, 1fr) auto;
159164
grid-template-areas:
160-
"sponsor-image sponsor-title"
161-
"sponsor-description sponsor-description"
162-
"sponsor-cta sponsor-cta";
163-
column-gap: 8px;
164-
row-gap: 10px;
165+
"sponsor-image"
166+
"sponsor-title"
167+
"sponsor-description"
168+
"sponsor-cta";
169+
row-gap: 3px;
165170
align-items: center;
166171
align-content: start;
167172
overflow: hidden;
@@ -177,20 +182,23 @@
177182
color: var(--sponsor-fg);
178183
overflow-wrap: anywhere;
179184
text-align: center;
185+
align-self: center;
180186
flex: 0 0 auto;
181187
}
182188
.sidesponsor .sponsor-title.sponsor-title--long {
183189
line-height: 1.02;
184190
}
185191
.sidesponsor:hover .sponsor-title{
186192
grid-area: sponsor-title;
187-
margin-left: 0;
193+
margin-left: 8px;
194+
margin-right: 8px;
188195
margin-top: 0;
189196
margin-bottom: 0;
190-
font-size: 1.55rem;
191-
line-height: 1.15;
197+
font-size: 1.45rem;
198+
line-height: 1.1;
192199
overflow-wrap: anywhere;
193200
align-self: center;
201+
justify-self: center;
194202
}
195203
.sidesponsor .sponsor-description{
196204
display: block;
@@ -203,23 +211,31 @@
203211
opacity: 0;
204212
visibility: hidden;
205213
overflow: hidden;
214+
transform: translateY(5px);
206215
transition:
207-
opacity .18s ease .14s,
208-
visibility 0s linear .32s;
216+
max-height .44s cubic-bezier(.22,1,.36,1),
217+
opacity .34s ease .08s,
218+
transform .44s cubic-bezier(.22,1,.36,1),
219+
visibility 0s linear .44s;
209220
}
210221
.sidesponsor:hover .sponsor-description{
211222
grid-area: sponsor-description;
223+
align-self: start;
212224
min-height: 0;
213225
max-height: 100%;
214-
margin-top: 0;
226+
margin-top: 3px;
215227
margin-bottom: 0;
216228
font-size: calc(1em - 1px);
217229
opacity: 1;
218230
visibility: visible;
231+
transform: translateY(0);
219232
overflow: auto;
220233
overscroll-behavior: contain;
221-
animation: sponsorTextReveal .12s ease .18s forwards;
222-
transition: none;
234+
transition:
235+
max-height .44s cubic-bezier(.22,1,.36,1),
236+
opacity .36s ease .08s,
237+
transform .44s cubic-bezier(.22,1,.36,1),
238+
visibility 0s linear 0s;
223239
}
224240
.sidesponsor .sponsor-cta{
225241
margin-top: auto;
@@ -235,20 +251,20 @@
235251
}
236252
.sidesponsor:hover .sponsor-cta{
237253
grid-area: sponsor-cta;
238-
margin-top: 22px;
239-
margin-bottom: 8px;
240-
padding: 9px 14px;
254+
margin-top: 4px;
255+
margin-bottom: 2px;
256+
padding: 11px 18px;
241257
box-sizing: border-box;
242258
max-width: 100%;
243259
overflow: hidden;
244260
text-overflow: ellipsis;
245261
white-space: nowrap;
246-
font-size: 1.2rem;
262+
font-size: 1.3rem;
247263
font-weight: 800;
248264
line-height: 1.1;
249265
visibility: hidden;
250266
opacity: 0;
251-
animation: sponsorTextReveal .12s ease .18s forwards;
267+
animation: sponsorTextReveal .28s ease .12s forwards;
252268
}
253269
@keyframes sponsorTextReveal {
254270
0% {

0 commit comments

Comments
 (0)