diff --git a/frontend/app.vue b/frontend/app.vue index 8d5c068..3cded66 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -6,7 +6,7 @@ - diff --git a/frontend/components/ToggleButton.vue b/frontend/components/ToggleButton.vue index cb2f69d..9f6b3b2 100644 --- a/frontend/components/ToggleButton.vue +++ b/frontend/components/ToggleButton.vue @@ -1,32 +1,26 @@ - diff --git a/frontend/nuxt.config.ts b/frontend/nuxt.config.ts index 0b4c2f9..c1ee256 100644 --- a/frontend/nuxt.config.ts +++ b/frontend/nuxt.config.ts @@ -13,23 +13,13 @@ export default defineNuxtConfig({ plugins: [ '@/plugins/fontawesome', ], - modules: ['@nuxtjs/color-mode'], - css: [ - '~/assets/styles/bootstrap.scss', - '~/assets/styles/main.css', - '~/assets/styles/normalize.css', - '~/assets/styles/animations.scss', - '@fortawesome/fontawesome-svg-core/styles.css' - ], - build: { - transpile: ['@fortawesome/vue-fontawesome'] - }, app: { + pageTransition: { + name: "page", + mode: "out-in", + }, head: { title: "A free API database list for developers", - bodyAttrs: { - 'data-theme': 'dark' - }, meta: [ { name: "keywords", content: "free api, apivault, api list, open-source, public APIs, software developer" }, { name: "description", content: "ApiVault - The largest collection of free public APIs, categorized for easy search." }, @@ -49,5 +39,15 @@ export default defineNuxtConfig({ { property: "og:type", content: "website"} ] } - } + }, + css: [ + '~/assets/styles/bootstrap.scss', + '~/assets/styles/main.css', + '~/assets/styles/normalize.css', + '~/assets/styles/animations.scss', + '@fortawesome/fontawesome-svg-core/styles.css' + ], + build: { + transpile: ['@fortawesome/vue-fontawesome'] + }, }) diff --git a/frontend/package.json b/frontend/package.json index f196e0d..0f43bfe 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-app", - "version": "2.0.0-b1", + "version": "2.0.0-b2.002", "private": true, "scripts": { "build": "nuxt build", @@ -24,7 +24,6 @@ "@fortawesome/free-brands-svg-icons": "^6.4.0", "@fortawesome/free-solid-svg-icons": "^6.4.0", "@fortawesome/vue-fontawesome": "^3.0.3", - "@nuxtjs/color-mode": "^3.2.0", "@popperjs/core": "^2.11.7", "axios": "^1.3.5", "bootstrap": "^5.2.3", diff --git a/frontend/utils/themeutils.ts b/frontend/utils/themeutils.ts index eaf5321..1f7e3c2 100644 --- a/frontend/utils/themeutils.ts +++ b/frontend/utils/themeutils.ts @@ -1,6 +1,4 @@ -export type Theme = "light" | "dark"; - -export function getTheme(): string { +export function setTheme(): string { const theme = localStorage.getItem("APIVaultTheme"); const prefersDark = window.matchMedia("(prefers-color-scheme: dark)"); if (process.client) { @@ -20,40 +18,25 @@ export const themeIcons: { [key: string]: string } = { dark: "fa-solid fa-moon", }; -export const setThemeElements = (theme: globalThis.Ref): string => { - const themeText = - theme.value[0].toUpperCase() + - theme.value.slice(1, theme.value.length) + - " Mode"; - if (theme.value === null) { - document.querySelector("body")?.setAttribute("data-theme", "dark"); - } - document.querySelector("body")?.setAttribute("data-theme", theme.value); - return themeText; +export const getThemeElements = (theme: globalThis.Ref): boolean => { + return theme.value === null || theme.value === 'dark'; } export const setThemeLogoPath = (theme: globalThis.Ref): string => { + if (theme.value === null || theme.value === undefined) { + return `/img/apivault-full-dark-nobg.png`; + } return `/img/apivault-full-${theme.value}-nobg.png`; } -/** -This code generates a string that represents the mode of the theme, -either "Light Mode" or "Dark Mode", depending on the theme.value -*/ -export const setIconThemeText = (theme: globalThis.Ref): string => { - return theme.value - ? theme.value[0].toUpperCase() + - theme.value.slice(1, theme.value.length) + - " Mode" - : " Mode" -} - -export const setLocalStorage = (theme: globalThis.Ref): void => { +export const setLocalStorage = (theme: globalThis.Ref): boolean => { if (theme.value === "dark" || theme.value === undefined) { theme.value = "light"; localStorage.setItem("APIVaultTheme", "light"); + return false; } else { theme.value = "dark"; localStorage.setItem("APIVaultTheme", "dark"); + return true; } } \ No newline at end of file