Skip to content

Commit 2ee70c9

Browse files
committed
crate.version: Add animated placeholders for the README loading state
1 parent 77cbbc1 commit 2ee70c9

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

app/components/front-page-list/item/placeholder.module.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.link {
22
--shadow: 0 2px 3px hsla(51, 50%, 44%, .35);
3+
--placeholder-bg: hsla(59, 19%, 50%, 1.0);
4+
--placeholder-bg2: hsla(59, 19%, 50%, 0.7);
35

46
display: flex;
57
align-items: center;

app/components/placeholder.module.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
.placeholder {
2-
--placeholder-bg: hsla(59, 19%, 50%, 1.0);
3-
--placeholder-bg2: hsla(59, 19%, 50%, 0.7);
4-
52
position: relative;
63
display: block;
74
overflow: hidden;
8-
background: linear-gradient(to right, var(--placeholder-bg) 8%, var(--placeholder-bg2) 18%, var(--placeholder-bg) 33%);
9-
background-size: 800px 104px;
5+
background: linear-gradient(to right, var(--placeholder-bg) 8%, var(--placeholder-bg2) 16%, var(--placeholder-bg) 29%);
6+
background-size: 1200px 100%;
107
animation-name: backgroundAnimation;
118
animation-duration: 1.5s;
129
animation-timing-function: linear;

app/styles/application.module.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
--link-color: rgb(0, 172, 91);
2222
--link-hover-color: #007940;
2323
--separator-color: #284725;
24+
25+
--placeholder-bg: hsl(212, 7%, 57%);
26+
--placeholder-bg2: hsl(213, 16%, 75%);
2427
}
2528

2629
:global(.new-design) {

app/styles/crate/version.module.css

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
}
3535
}
3636

37-
.readme-spinner,
3837
.no-readme {
3938
padding: 40px 15px;
4039
text-align: center;
@@ -47,8 +46,28 @@
4746
}
4847
}
4948

50-
.readme-spinner > div {
51-
--spinner-size: 35px;
49+
.placeholder-title {
50+
width: 30%;
51+
height: 25px;
52+
margin: 15px 0 25px;
53+
border-radius: 5px;
54+
opacity: 0.6;
55+
}
56+
57+
.placeholder-subtitle {
58+
width: 50%;
59+
height: 20px;
60+
margin: 35px 0 25px;
61+
border-radius: 5px;
62+
opacity: 0.6;
63+
}
64+
65+
.placeholder-text {
66+
width: 100%;
67+
height: 16px;
68+
margin-top: 15px;
69+
border-radius: 5px;
70+
opacity: 0.3;
5271
}
5372

5473
.sidebar {

app/templates/crate/version.hbs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@
2222
<div local-class="docs">
2323
{{#if this.loadReadmeTask.isRunning}}
2424
<div local-class="readme-spinner">
25-
<LoadingSpinner/>
25+
<Placeholder local-class="placeholder-title" />
26+
<Placeholder local-class="placeholder-text" />
27+
<Placeholder local-class="placeholder-text" />
28+
<Placeholder local-class="placeholder-text" />
29+
<Placeholder local-class="placeholder-text" />
30+
<Placeholder local-class="placeholder-text" />
31+
<Placeholder local-class="placeholder-subtitle" />
32+
<Placeholder local-class="placeholder-text" />
33+
<Placeholder local-class="placeholder-text" />
34+
<Placeholder local-class="placeholder-text" />
2635
</div>
2736
{{else if this.readme}}
2837
<article aria-label="Readme">

0 commit comments

Comments
 (0)