Skip to content

Commit

Permalink
chore: fix live-demo build, install as npm package for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
kaandesu committed Apr 29, 2023
1 parent 43ad344 commit ae4a3bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-daisyui-theme-manager",
"author": "I Kaan Yilmaz <kaandesu00@gmail.com> (https://github.com/kaandesu)",
"version": "0.0.28",
"version": "0.0.29",
"license": "MIT",
"description": "A plugin that allows you to change DaisyUI themes during runtime. As well as, setting default light and dark themes, and matching the system theme.",
"contributors": [
Expand Down Expand Up @@ -50,7 +50,8 @@
},
"dependencies": {
"daisyui": "^2.51.6",
"vue": "^3.2.47"
"vue": "^3.2.47",
"vue-daisyui-theme-manager": "^0.0.28"
},
"devDependencies": {
"@types/node": "^18.15.11",
Expand Down
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { type DaisyThemes, useThemeManager } from './themeManager'
import { useThemeManager } from 'vue-daisyui-theme-manager'
const daisyThemes = [
'default',
'light',
Expand Down Expand Up @@ -36,7 +36,7 @@ const daisyThemes = [
] as const;
import { ref, computed } from 'vue';
const $theme = useThemeManager()
const changeTheme = (e: any) => $theme.set(e.target.value as DaisyThemes)
const changeTheme = (e: any) => $theme.set({theme:e.target.value})
const selected = computed(() => $theme.get())
const useSystem = ref<boolean>($theme.watchSystemTheme())
const toggleWatchSystem = () => $theme.watchSystemTheme(useSystem.value)
Expand All @@ -56,6 +56,7 @@ const isDarkMode = computed(() => {
<div class="container">
<section class="options-container">
<div class="flexCol">
Select theme:
<select v-model="selected" @change="e => changeTheme(e)" class="select select-primary w-full max-w-xs">
<option disabled selected>Select a theme!</option>
<option v-for="theme in daisyThemes" :key="theme">{{ theme }}</option>
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import App from './App.vue'
import { createThemeManager } from '../src/themeManager'

const app = createApp(App)
app.use(createThemeManager({ light: 'breeze', dark: 'storm', watchSystemTheme: true }))
app.use(createThemeManager({ light: 'light', dark: 'dark', watchSystemTheme: true }))

app.mount('#app')

0 comments on commit ae4a3bf

Please sign in to comment.