diff options
author | Grigorii K. Shartsev <me@shgk.me> | 2023-06-08 17:09:31 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-06-09 08:46:20 +0000 |
commit | 86f2cf781724acc1970a0390a9d8ed94f75db884 (patch) | |
tree | abf9de90bb1f3c4259c0f181fd1b13b8aec0bec3 /src | |
parent | f46bd19aa18717115b5c4d7e8da8f1b369ab2a6f (diff) |
fix(frontend): fix loading placeholder dark/light theme
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/LoadingPlaceholder.vue | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/components/LoadingPlaceholder.vue b/src/components/LoadingPlaceholder.vue index 9f64e2e12..cb0b4bbe0 100644 --- a/src/components/LoadingPlaceholder.vue +++ b/src/components/LoadingPlaceholder.vue @@ -36,8 +36,8 @@ each other by animating the opacities. <svg :key="'gradient' + suffix" :class="'placeholder-gradient placeholder-gradient' + suffix"> <defs> <linearGradient :id="'placeholder-gradient' + suffix"> - <stop offset="0%" :stop-color="(gradientIndex == 0) ? light : dark" /> - <stop offset="100%" :stop-color="(gradientIndex == 0) ? dark : light" /> + <stop offset="0%" :stop-color="(gradientIndex === 0) ? colorPlaceholderLight : colorPlaceholderDark" /> + <stop offset="100%" :stop-color="(gradientIndex === 0) ? colorPlaceholderDark : colorPlaceholderLight" /> </linearGradient> </defs> </svg> @@ -69,6 +69,10 @@ each other by animating the opacities. </template> <script> +const bodyStyles = window.getComputedStyle(document.body) +const colorPlaceholderDark = bodyStyles.getPropertyValue('--color-placeholder-dark') +const colorPlaceholderLight = bodyStyles.getPropertyValue('--color-placeholder-light') + export default { name: 'LoadingPlaceholder', @@ -83,10 +87,10 @@ export default { }, }, - data() { + setup() { return { - light: null, - dark: null, + colorPlaceholderDark, + colorPlaceholderLight, } }, @@ -100,12 +104,6 @@ export default { return data }, }, - - mounted() { - const styles = getComputedStyle(document.documentElement) - this.dark = styles.getPropertyValue('--color-placeholder-dark') - this.light = styles.getPropertyValue('--color-placeholder-light') - }, } </script> |