Skip to content

Commit 7089d3a

Browse files
committed
Improve sponsor ad hover layout
1 parent a0b3be4 commit 7089d3a

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
@@ -110,6 +110,7 @@
110110
padding: 5px;
111111
display: none; /*changed via JS once ad is loaded*/
112112
flex-direction: column;
113+
align-items: center;
113114
text-decoration: none !important;
114115
overflow: hidden;
115116
backdrop-filter: blur(6px);
@@ -124,27 +125,31 @@
124125
object-fit: contain;
125126
align-self: center;
126127
flex: 0 0 auto;
127-
transition-property: all;
128-
transition-timing-function: cubic-bezier(.4,0,.2,1);
129-
transition-duration: .3s;
128+
transition:
129+
height .36s cubic-bezier(.22,1,.36,1),
130+
width .36s cubic-bezier(.22,1,.36,1),
131+
max-height .36s cubic-bezier(.22,1,.36,1),
132+
min-height .36s cubic-bezier(.22,1,.36,1),
133+
padding .36s cubic-bezier(.22,1,.36,1),
134+
transform .36s cubic-bezier(.22,1,.36,1);
130135
}
131136
.sidesponsor:hover img{
132-
width: 42px;
137+
width: 56px;
133138
padding: 4px;
134139
grid-area: sponsor-image;
135140
align-self: center;
136-
transition-duration: 0s;
141+
justify-self: center;
137142
}
138143
.sidesponsor:hover {
139144
display: grid !important;
140-
grid-template-columns: auto minmax(0, 1fr);
141-
grid-template-rows: max-content minmax(0, 1fr) auto;
145+
grid-template-columns: minmax(0, 1fr);
146+
grid-template-rows: max-content max-content minmax(0, 1fr) auto;
142147
grid-template-areas:
143-
"sponsor-image sponsor-title"
144-
"sponsor-description sponsor-description"
145-
"sponsor-cta sponsor-cta";
146-
column-gap: 8px;
147-
row-gap: 10px;
148+
"sponsor-image"
149+
"sponsor-title"
150+
"sponsor-description"
151+
"sponsor-cta";
152+
row-gap: 3px;
148153
align-items: center;
149154
align-content: start;
150155
overflow: hidden;
@@ -160,20 +165,23 @@
160165
color: var(--sponsor-fg);
161166
overflow-wrap: anywhere;
162167
text-align: center;
168+
align-self: center;
163169
flex: 0 0 auto;
164170
}
165171
.sidesponsor .sponsor-title.sponsor-title--long {
166172
line-height: 1.02;
167173
}
168174
.sidesponsor:hover .sponsor-title{
169175
grid-area: sponsor-title;
170-
margin-left: 0;
176+
margin-left: 8px;
177+
margin-right: 8px;
171178
margin-top: 0;
172179
margin-bottom: 0;
173-
font-size: 1.55rem;
174-
line-height: 1.15;
180+
font-size: 1.45rem;
181+
line-height: 1.1;
175182
overflow-wrap: anywhere;
176183
align-self: center;
184+
justify-self: center;
177185
}
178186
.sidesponsor .sponsor-description{
179187
display: block;
@@ -186,23 +194,31 @@
186194
opacity: 0;
187195
visibility: hidden;
188196
overflow: hidden;
197+
transform: translateY(5px);
189198
transition:
190-
opacity .18s ease .14s,
191-
visibility 0s linear .32s;
199+
max-height .44s cubic-bezier(.22,1,.36,1),
200+
opacity .34s ease .08s,
201+
transform .44s cubic-bezier(.22,1,.36,1),
202+
visibility 0s linear .44s;
192203
}
193204
.sidesponsor:hover .sponsor-description{
194205
grid-area: sponsor-description;
206+
align-self: start;
195207
min-height: 0;
196208
max-height: 100%;
197-
margin-top: 0;
209+
margin-top: 3px;
198210
margin-bottom: 0;
199211
font-size: calc(1em - 1px);
200212
opacity: 1;
201213
visibility: visible;
214+
transform: translateY(0);
202215
overflow: auto;
203216
overscroll-behavior: contain;
204-
animation: sponsorTextReveal .12s ease .18s forwards;
205-
transition: none;
217+
transition:
218+
max-height .44s cubic-bezier(.22,1,.36,1),
219+
opacity .36s ease .08s,
220+
transform .44s cubic-bezier(.22,1,.36,1),
221+
visibility 0s linear 0s;
206222
}
207223
.sidesponsor .sponsor-cta{
208224
margin-top: auto;
@@ -218,20 +234,20 @@
218234
}
219235
.sidesponsor:hover .sponsor-cta{
220236
grid-area: sponsor-cta;
221-
margin-top: 22px;
222-
margin-bottom: 8px;
223-
padding: 9px 14px;
237+
margin-top: 4px;
238+
margin-bottom: 2px;
239+
padding: 11px 18px;
224240
box-sizing: border-box;
225241
max-width: 100%;
226242
overflow: hidden;
227243
text-overflow: ellipsis;
228244
white-space: nowrap;
229-
font-size: 1.2rem;
245+
font-size: 1.3rem;
230246
font-weight: 800;
231247
line-height: 1.1;
232248
visibility: hidden;
233249
opacity: 0;
234-
animation: sponsorTextReveal .12s ease .18s forwards;
250+
animation: sponsorTextReveal .28s ease .12s forwards;
235251
}
236252
@keyframes sponsorTextReveal {
237253
0% {

0 commit comments

Comments
 (0)