Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): destructure slot data binding for DarkToggle component #160

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/client/src/components/common/DockingPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ watch(activeAppRecordId, (id) => {
<VueDarkToggle>
<template #default="{ isDark, toggle }">
<VueButton outlined type="primary" @click="toggle">
<div i-carbon-sun dark:i-carbon-moon translate-y--1px /> {{ isDark.value ? 'Dark' : 'Light' }}
<div i-carbon-sun dark:i-carbon-moon translate-y--1px /> {{ isDark ? 'Dark' : 'Light' }}
</VueButton>
</template>
</VueDarkToggle>
Expand Down
7 changes: 1 addition & 6 deletions packages/ui/src/components/DarkToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@ function toggle(event?: MouseEvent) {
)
})
}
const context = {
mode,
isDark,
toggle,
}
</script>

<template>
<span class="$ui-dark-toggle-vtr">
<slot v-bind="context" />
<slot v-bind="{ mode, isDark, toggle }" />
</span>
</template>
4 changes: 2 additions & 2 deletions packages/ui/storybook/DarkToggle.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const dark = computed({
toggle(e)
}"
>
<Icon :class="isDark.value ? 'i-carbon-moon' : 'i-carbon-sun'" />
<Icon :class="isDark ? 'i-carbon-moon' : 'i-carbon-sun'" />
</Button>
</template>
</DarkToggle>
Expand All @@ -37,7 +37,7 @@ const dark = computed({
toggle(e)
}"
>
<Icon :class="isDark.value ? 'i-carbon-moon' : 'i-carbon-sun'" />
<Icon :class="isDark ? 'i-carbon-moon' : 'i-carbon-sun'" />
</Button>
</template>
</DarkToggle>
Expand Down