Skip to content

Commit

Permalink
fix: fix wrong test button color on custom domain
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Feb 16, 2024
1 parent ba0729e commit 768225c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/Tune/TuneButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ withDefaults(
}
);
const skin = ref<string | null>(null);
const { domain } = useApp();
const { getSkin } = useSkin();
onMounted(async () => await getSkin(domain));
</script>

<template>
Expand All @@ -28,7 +33,7 @@ const { domain } = useApp();
primary: primary,
danger: variant === 'danger',
disabled: disabled,
'!text-skin-bg': !domain && primary
'!text-skin-bg': !skin && primary
}
]"
:disabled="disabled || loading"
Expand Down
6 changes: 5 additions & 1 deletion src/composables/useSkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const skinClass = ref('default');
export function useSkin() {
const { apolloQuery } = useApolloQuery();

async function getSkin(domain: string) {
async function getSkin(domain: string): Promise<string | null> {
if (domain) {
const space = await apolloQuery(
{
Expand All @@ -41,8 +41,12 @@ export function useSkin() {
if (space?.skin) {
skinClass.value = space.skin;
document.body.classList.add(skinClass.value);

return space.skin;
}
}

return null;
}

const getThemeIcon = () => (theme.value === LIGHT ? 'moon' : 'sun');
Expand Down

0 comments on commit 768225c

Please sign in to comment.