Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit 40464af

Browse files
committed
feat: show random funfacts in loader
1 parent 69c8649 commit 40464af

File tree

1 file changed

+45
-12
lines changed

1 file changed

+45
-12
lines changed

components/shared/Loader.vue

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,32 @@
44
is-full-page
55
:can-cancel="true"
66
>
7-
<figure>
8-
<img
9-
class="loading-icon"
10-
:src="placeholder"
11-
>
12-
<figcaption
13-
v-if="status"
14-
class="loading-text"
15-
>
16-
{{ $t(status) }}
17-
</figcaption>
18-
</figure>
7+
<div class="loading-container">
8+
<p class="funfact-text">
9+
<span class="text-bold funcfact-heading">{{ randomFunFactHeading }}</span>
10+
<br/>
11+
{{ randomFunFactQuestion }}
12+
</p>
13+
<figure>
14+
<img
15+
class="loading-icon"
16+
:src="placeholder"
17+
>
18+
<figcaption
19+
v-if="status"
20+
class="loading-text"
21+
>
22+
{{ $t(status) }}
23+
</figcaption>
24+
</figure>
25+
</div>
1926
</b-loading>
2027
</template>
2128

2229
<script lang="ts" >
2330
import { Component, Prop, Vue } from 'nuxt-property-decorator'
31+
import { randomIntegerInRange } from '@/utils/calculation'
32+
import i18n from '@/i18n'
2433
2534
@Component({})
2635
export default class Loader extends Vue {
@@ -29,6 +38,16 @@ export default class Loader extends Vue {
2938
3039
protected placeholder = '/infinity.svg';
3140
41+
protected randomNumber = randomIntegerInRange(1, 33)
42+
43+
get randomFunFactHeading() {
44+
return i18n.t(`funfacts.${this.randomNumber}.heading`)
45+
}
46+
47+
get randomFunFactQuestion() {
48+
return i18n.t(`funfacts.${this.randomNumber}.question`)
49+
}
50+
3251
get isLoading() {
3352
return this.value
3453
}
@@ -40,6 +59,20 @@ export default class Loader extends Vue {
4059
</script>
4160

4261
<style scoped>
62+
.loading-container {
63+
text-align: center;
64+
}
65+
.funfact-text{
66+
position: relative;
67+
color: white;
68+
margin-bottom: .5rem;
69+
max-width: 450px;
70+
}
71+
.funcfact-heading {
72+
color: #d32e79;
73+
font-size: 1.2rem;
74+
line-height: 2.5rem;
75+
}
4376
.loading-text {
4477
position: relative;
4578
max-width: 200px;

0 commit comments

Comments
 (0)