Skip to content

Commit

Permalink
create localized theme styles for osnapbutton comp
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteenkamp89 committed Nov 22, 2023
1 parent 758d6e6 commit c182420
Showing 1 changed file with 40 additions and 6 deletions.
46 changes: 40 additions & 6 deletions src/components/SettingsTreasuryActivateOsnapButton.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,58 @@
<script setup lang="ts">
const { theme } = useSkin();
defineProps<{
isOsnapEnabled: boolean;
}>();
// handling some theming here locally so as not to interfere with the global style.scss file
const activeStyles = computed(() => {
return theme.value === 'light'
? {
div: 'bg-[hsla(122,100%,45%,0.13)] text-[hsla(122,100%,21%,1)]',
span: 'bg-[hsla(122,100%,45%,1)]'
}
: {
div: 'bg-[hsla(122,100%,45%,0.13)] text-[hsla(122,100%,45%,1)]',
span: 'bg-[hsla(122,100%,45%,1)]'
};
});
const inactiveStyles = computed(() => {
return theme.value === 'light'
? {
div: 'bg-[hsla(0,0%,0%,1)] text-skin-bg',
span: 'bg-skin-bg opacity-30'
}
: {
div: 'bg-[hsla(0,0%,100%,1)] text-skin-bg',
span: 'bg-skin-bg opacity-30'
};
});
</script>

<template>
<button
v-if="isOsnapEnabled"
class="flex items-center gap-2 rounded-full bg-[hsla(122,100%,45%,0.13)] px-3 py-2 text-[hsl(122,100%,21%)]"
:class="[
'flex items-center gap-2 rounded-full px-3 py-2',
activeStyles.div
]"
>
<span
class="block h-[6px] w-[6px] rounded-full bg-[hsl(122,100%,45%)]"
></span
>oSnap activated
:class="['block h-[6px] w-[6px] rounded-full', activeStyles.span]"
/>oSnap activated
</button>
<button
v-else
class="flex items-center gap-2 rounded-full bg-black px-3 py-2 text-white"
:class="[
'flex items-center gap-2 rounded-full px-3 py-2',
inactiveStyles.div
]"
>
<span class="block h-[6px] w-[6px] rounded-full bg-white/30"></span>
<span
:class="['block h-[6px] w-[6px] rounded-full', inactiveStyles.span]"
/>
Activate oSnap
</button>
</template>

0 comments on commit c182420

Please sign in to comment.