mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-26 07:33:21 +03:00
- Added a loading background color for light and dark theme (#166)
- Changed the color of the loader from white to the primary green color of IT-Tools - Made the background of the splashscreen a slightly lighter gray to ease the difference between the loading background color of light and dark mode FIx #161
This commit is contained in:
1 parent
0462c17fc1
commit
0325b11746
4 files changed
+32
-11
No files matched your search
+26
-7
@@ -4,6 +4,7 @@ import { NGlobalStyle, NMessageProvider, NNotificationProvider, darkTheme } from
|
|||||||
import { darkThemeOverrides, lightThemeOverrides } from './themes';
|
import { darkThemeOverrides, lightThemeOverrides } from './themes';
|
||||||
import { layouts } from './layouts';
|
import { layouts } from './layouts';
|
||||||
import { useStyleStore } from './stores/style.store';
|
import { useStyleStore } from './stores/style.store';
|
||||||
|
import { useAppTheme } from './ui/theme/themes';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const layout = computed(() => route?.meta?.layout ?? layouts.base);
|
const layout = computed(() => route?.meta?.layout ?? layouts.base);
|
||||||
@@ -14,6 +15,21 @@ const themeOverrides = computed(() => (styleStore.isDarkTheme ? darkThemeOverrid
|
|||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
||||||
|
const colorPalette = useAppTheme();
|
||||||
|
|
||||||
|
// Create CSS custom properties for the color palette
|
||||||
|
const cssVars = computed(() => ({
|
||||||
|
'--loading-background-color': colorPalette.value.loading_background,
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Apply CSS variables to the document root
|
||||||
|
watchEffect(() => {
|
||||||
|
const root = document.documentElement;
|
||||||
|
Object.entries(cssVars.value).forEach(([key, value]) => {
|
||||||
|
root.style.setProperty(key, value);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
syncRef(
|
syncRef(
|
||||||
locale,
|
locale,
|
||||||
useStorage('locale', locale),
|
useStorage('locale', locale),
|
||||||
@@ -25,9 +41,11 @@ syncRef(
|
|||||||
<NGlobalStyle />
|
<NGlobalStyle />
|
||||||
<NMessageProvider placement="bottom">
|
<NMessageProvider placement="bottom">
|
||||||
<NNotificationProvider placement="bottom-right">
|
<NNotificationProvider placement="bottom-right">
|
||||||
<component :is="layout">
|
<div>
|
||||||
<RouterView />
|
<component :is="layout">
|
||||||
</component>
|
<RouterView />
|
||||||
|
</component>
|
||||||
|
</div>
|
||||||
</NNotificationProvider>
|
</NNotificationProvider>
|
||||||
</NMessageProvider>
|
</NMessageProvider>
|
||||||
</n-config-provider>
|
</n-config-provider>
|
||||||
@@ -51,15 +69,16 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body .vld-container {
|
body .vld-container {
|
||||||
position:absolute;
|
position: absolute;
|
||||||
left:0;
|
left: 0;
|
||||||
top:0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
background-color: #101014;
|
background-color: var(--loading-background-color);
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
body .vld-container .vl-overlay.vl-active {
|
body .vld-container .vl-overlay.vl-active {
|
||||||
margin-top: 15%;
|
margin-top: 15%;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -6,9 +6,9 @@ import NotFound from './pages/404.page.vue';
|
|||||||
import { tools } from './tools';
|
import { tools } from './tools';
|
||||||
import { config } from './config';
|
import { config } from './config';
|
||||||
import { routes as demoRoutes } from './ui/demo/demo.routes';
|
import { routes as demoRoutes } from './ui/demo/demo.routes';
|
||||||
|
import { useAppTheme } from './ui/theme/themes';
|
||||||
|
|
||||||
const $loading = useLoading();
|
const $loading = useLoading();
|
||||||
|
|
||||||
const toolsRoutes = tools.map(({ path, name, component, ...config }) => ({
|
const toolsRoutes = tools.map(({ path, name, component, ...config }) => ({
|
||||||
path,
|
path,
|
||||||
name,
|
name,
|
||||||
@@ -46,9 +46,9 @@ let loader: ActiveLoader | null = null;
|
|||||||
router.beforeEach((to, from) => {
|
router.beforeEach((to, from) => {
|
||||||
// Only show loading for actual route changes, not just query param changes
|
// Only show loading for actual route changes, not just query param changes
|
||||||
if (to.path !== from.path) {
|
if (to.path !== from.path) {
|
||||||
|
const theme = useAppTheme();
|
||||||
loader = $loading?.show({
|
loader = $loading?.show({
|
||||||
color: '#fff',
|
color: theme.value.primary.color,
|
||||||
backgroundColor: '#292929',
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export const { themes: appThemes, useTheme: useAppTheme } = defineThemes({
|
|||||||
colorPressed: '#ab1f3f',
|
colorPressed: '#ab1f3f',
|
||||||
colorFaded: '#d030502a',
|
colorFaded: '#d030502a',
|
||||||
},
|
},
|
||||||
|
loading_background: '#f1f5f9',
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
background: '#1e1e1e',
|
background: '#1e1e1e',
|
||||||
@@ -72,5 +73,6 @@ export const { themes: appThemes, useTheme: useAppTheme } = defineThemes({
|
|||||||
colorPressed: '#e57272',
|
colorPressed: '#e57272',
|
||||||
colorFaded: '#e8808029',
|
colorFaded: '#e8808029',
|
||||||
},
|
},
|
||||||
|
loading_background: '#1c1c1c',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
+1
-1
@@ -108,7 +108,7 @@ export default defineConfig({
|
|||||||
wasm(),
|
wasm(),
|
||||||
splashScreen({
|
splashScreen({
|
||||||
logoSrc: 'logo.svg',
|
logoSrc: 'logo.svg',
|
||||||
splashBg: '#292929',
|
splashBg: '#383838',
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
base: baseUrl,
|
base: baseUrl,
|
||||||
|
|||||||
Reference in new issue
Block a user