Skip to content

Commit 7626e4d

Browse files
committed
perf(ui): improve hover effect for post preview cards
- home cards - navigator buttons at the bottom post
1 parent 34499f0 commit 7626e4d

File tree

4 files changed

+52
-35
lines changed

4 files changed

+52
-35
lines changed

_sass/addon/commons.scss

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,32 @@ i {
395395

396396
/* --- post --- */
397397

398+
.post-preview {
399+
@extend %rounded;
400+
401+
border: 0;
402+
background: var(--card-bg);
403+
box-shadow: var(--card-shadow);
404+
405+
&::before {
406+
@extend %rounded;
407+
408+
content: '';
409+
width: 100%;
410+
height: 100%;
411+
position: absolute;
412+
background-color: var(--card-hovor-bg);
413+
opacity: 0;
414+
transition: opacity 0.35s ease-in-out;
415+
}
416+
417+
&:hover {
418+
&::before {
419+
opacity: 0.3;
420+
}
421+
}
422+
}
423+
398424
.post {
399425
h1 {
400426
margin-top: 3rem;
@@ -636,22 +662,6 @@ i {
636662
@extend %no-decoration;
637663
}
638664

639-
.card.post-preview {
640-
border-radius: $card-radius;
641-
border: 0;
642-
background: var(--card-bg);
643-
box-shadow: rgba(0, 0, 0, 0.05) 0 6px 14px 0,
644-
var(--card-border-color) 0 0 0 1px;
645-
646-
&:hover {
647-
background-color: var(--card-hovor-bg);
648-
649-
img {
650-
filter: brightness(0.7) !important;
651-
}
652-
}
653-
}
654-
655665
/* overwrite bootstrap muted */
656666
.text-muted {
657667
color: var(--text-muted-color) !important;
@@ -666,7 +676,7 @@ i {
666676

667677
/* Overwrite bootstrap outline button */
668678
.btn.btn-outline-primary {
669-
&:hover {
679+
&:not(.disabled):hover {
670680
border-color: #007bff !important;
671681
}
672682
}

_sass/colors/dark-typography.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@
6767
--btn-share-hover-color: #bfc1ca;
6868
--relate-post-date: var(--text-muted-color);
6969
--card-bg: #1e1e1e;
70-
--card-hovor-bg: #3a3a3a;
71-
--card-border-color: rgba(172, 169, 169, 0.17);
70+
--card-hovor-bg: #464d51;
71+
--card-shadow: rgb(21, 21, 21, 0.72) 0 6px 10px 0,
72+
rgb(137, 135, 135, 0.3) 0 0 0 1px;
7273
--kbd-wrap-color: #6a6a6a;
7374
--kbd-text-color: #d3d3d3;
7475
--kbd-bg-color: #242424;

_sass/colors/light-typography.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
--btn-share-hover-color: var(--link-color);
6464
--card-bg: white;
6565
--card-hovor-bg: #e2e2e2;
66-
--card-border-color: rgba(172, 169, 169, 0.13);
66+
--card-shadow: rgb(104, 104, 104, 0.05) 0 2px 6px 0,
67+
rgba(211, 209, 209, 0.15) 0 0 0 1px;
6768
--label-color: #616161;
6869
--relate-post-date: rgba(30, 55, 70, 0.4);
6970
--footnote-target-bg: lightcyan;

_sass/layout/post.scss

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
}
1212

13-
@mixin btn-post-nav {
13+
%btn-post-nav {
1414
width: 50%;
1515
position: relative;
1616
border-color: var(--btn-border-color);
@@ -172,27 +172,25 @@ h1 + .post-meta {
172172
padding-bottom: 4rem;
173173

174174
.btn {
175-
@include btn-post-nav;
175+
@extend %btn-post-nav;
176176

177-
color: var(--link-color);
177+
&:not(:hover) {
178+
color: var(--link-color);
179+
}
178180

179181
&:hover {
180-
background: #2a408e;
181-
color: #ffffff;
182-
border-color: #2a408e;
182+
&:not(.disabled)::before {
183+
color: whitesmoke;
184+
}
183185
}
184186

185187
&.disabled {
186-
@include btn-post-nav;
188+
@extend %btn-post-nav;
187189

188190
pointer-events: auto;
189191
cursor: not-allowed;
190192
background: none;
191193
color: gray;
192-
193-
&:hover {
194-
border-color: none;
195-
}
196194
}
197195

198196
&.btn-outline-primary.disabled:focus {
@@ -207,14 +205,12 @@ h1 + .post-meta {
207205
}
208206

209207
&:first-child {
210-
border-top-right-radius: 0;
211-
border-bottom-right-radius: 0;
208+
border-radius: $card-radius 0 0 $card-radius;
212209
left: 0.5px;
213210
}
214211

215212
&:last-child {
216-
border-top-left-radius: 0;
217-
border-bottom-left-radius: 0;
213+
border-radius: 0 $card-radius $card-radius 0;
218214
right: 0.5px;
219215
}
220216
}
@@ -227,6 +223,15 @@ h1 + .post-meta {
227223
}
228224
} /* .post-navigation */
229225

226+
@media (hover: hover) {
227+
.post-navigation {
228+
.btn,
229+
.btn::before {
230+
transition: all 0.35s ease-in-out;
231+
}
232+
}
233+
}
234+
230235
@-webkit-keyframes fade-up {
231236
from {
232237
opacity: 0;

0 commit comments

Comments
 (0)