Skip to content

Commit 610f0c7

Browse files
Use dynamic background based on day
1 parent 76d0252 commit 610f0c7

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

app.vue

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<template>
2+
<NuxtLoadingIndicator />
23
<NuxtLayout>
34
<NuxtPage keepalive />
45
</NuxtLayout>

layouts/default.vue

+21
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,27 @@
8888
<script>
8989
import MaterialIcon from '~/components/MaterialIcon.vue';
9090
import TheTitle from '~/components/TheTitle.vue';
91+
92+
// Hardcode splash art links for performance reasons. This is the layout after all.
93+
const splashes = [
94+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498000.jpg", // Xayah - Sunday
95+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498001.jpg", // Cosmic Dusk - Monday
96+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498002.jpg", // Sweetheart - Tuesday
97+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498004.jpg", // Star Guardian - Wednesday
98+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498028.jpg", // Arcana - Thursday
99+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498037.jpg", // Broken Convenant - Friday
100+
"https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498038.jpg", // Redeemed Star Guardian - Saturday
101+
];
102+
103+
const date = new Date();
104+
const day = date.getDay();
105+
106+
useHead({
107+
htmlAttrs: {
108+
"data-bs-theme": "dark",
109+
"style": `background-image: url('${splashes[day]}')` // Use splash of corresponding day
110+
}
111+
});
91112
</script>
92113

93114
<style lang="scss">

nuxt.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default defineNuxtConfig({
1515
head: {
1616
htmlAttrs: {
1717
"data-bs-theme": "dark",
18-
"style": "background-image: url('https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498004.jpg');"
18+
"style": "background-image: url('https://raw.communitydragon.org/14.9/plugins/rcp-be-lol-game-data/global/default/v1/champion-splashes/498/498000.jpg');"
1919
},
2020
bodyAttrs: {
2121
class: "h-100"

public/css/app.css

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
html {
66
font-size: 14px;
77

8+
background-image: none;
89
background-repeat: no-repeat;
910
background-size: cover;
1011
background-attachment: fixed;

0 commit comments

Comments
 (0)