Skip to content

Commit 6f12d6a

Browse files
authored
Merge pull request #312 from MITLibraries/use-282
USE-282: Styling libkey links
2 parents cba9e80 + 383dbaa commit 6f12d6a

File tree

3 files changed

+51
-9
lines changed

3 files changed

+51
-9
lines changed

app/assets/stylesheets/partials/_effects.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,40 @@
2929
outline-offset: 2px;
3030
}
3131
}
32+
33+
// SKELETON LOADER
34+
35+
@mixin skeleton-loader($width, $height:2rem) {
36+
background-color: $color-gray-200;
37+
border-radius: 4px;
38+
display: inline-block;
39+
height: $height;
40+
position: relative;
41+
overflow: hidden;
42+
font-size: inherit;
43+
min-width: $width;
44+
45+
&::after {
46+
position: absolute;
47+
top: 0;
48+
right: 0;
49+
bottom: 0;
50+
left: 0;
51+
transform: translateX(-100%);
52+
background-image: linear-gradient(
53+
90deg,
54+
rgba(#fff, 0) 0,
55+
rgba(#fff, 0.2) 20%,
56+
rgba(#fff, 0.5) 60%,
57+
rgba(#fff, 0)
58+
);
59+
animation: shimmer 1s infinite;
60+
content: '';
61+
}
62+
63+
@keyframes shimmer {
64+
100% {
65+
transform: translateX(100%);
66+
}
67+
}
68+
}

app/assets/stylesheets/partials/_results.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,29 @@
225225
font-family: $base-font; // Since we're using 16px, override to use body font
226226
}
227227

228+
.result-get {
229+
display: flex;
230+
align-items: center;
231+
gap: 24px;
232+
}
233+
228234
// Make result buttons present as underlined links
229235
a.button {
230236
@include underlinedLinks;
231237
font-weight: $fw-medium;
232238
font-size: 1.6rem;
233-
margin-right: 16px;
234239
}
235240

236241
// Except the first button, which should present as a secondary button
237-
a.button:first-child {
242+
.result-get > a.button:first-child {
238243
@include buttonSecondary;
239244
}
240245

246+
// Loading skeleton when a button isn't available
247+
span.skeleton-loader {
248+
@include skeleton-loader(112px);
249+
}
250+
241251
.truncate-list li:last-child {margin-bottom: 0;}
242252

243253
}

app/views/search/_trigger_libkey.html.erb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@
22

33
<% data_url = "/lookup?type=#{kind}&identifier=#{identifier}" %>
44

5-
<span class="tacos-container"
5+
<span class="libkey-container"
66
data-controller="content-loader"
77
data-content-loader-url-value=<%= data_url %>>
8-
<span style="background-color:lightgray;
9-
display: inline-block;
10-
font-size: 1.6rem;
11-
font-weight: 500;
12-
margin-right: 16px;
13-
min-width: 120px;">&nbsp;</span>
8+
<span class="skeleton-loader">&nbsp;</span>
149
</span>

0 commit comments

Comments
 (0)