mirror of
https://github.com/unraid/api.git
synced 2026-01-04 07:29:48 -06:00
Added a Vite plugin to automatically inject the Tailwind CSS import into the `unraid-components.client.js` entry file, enhancing the integration of Tailwind CSS within the application. This change improves the setup for styling components consistently across the project. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added automated validation to ensure Tailwind CSS styles are correctly included in the custom elements build output. * **Chores** * Updated the build process to include a CSS validation step after manifest generation. * Enhanced development build configuration to enable CSS source maps and optimize Tailwind CSS injection into web components. * Extended CSS theme with new responsive breakpoint variables. * Improved CSS class specificity in user profile, server state, and update modal components for consistent styling. * Removed redundant style blocks and global CSS imports from multiple components to streamline styling and reduce duplication. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
77 lines
2.3 KiB
Vue
77 lines
2.3 KiB
Vue
<script lang="ts" setup>
|
|
import { reactive, watch } from 'vue';
|
|
|
|
import { Input, Label, Select, Switch } from '@unraid/ui';
|
|
import { defaultColors } from '~/themes/default';
|
|
|
|
import type { Theme } from '~/themes/types';
|
|
|
|
import { useThemeStore } from '~/store/theme';
|
|
|
|
const themeStore = useThemeStore();
|
|
|
|
// Form state
|
|
const form = reactive({
|
|
selectedTheme: 'white',
|
|
gradient: false,
|
|
description: true,
|
|
banner: true,
|
|
textPrimary: '',
|
|
textSecondary: '',
|
|
bgColor: '',
|
|
});
|
|
|
|
// Watch for changes and update theme
|
|
watch([form], () => {
|
|
// Enable gradient if banner is enabled
|
|
if (form.banner && !form.gradient) {
|
|
form.gradient = true;
|
|
}
|
|
|
|
const themeToSet: Theme = {
|
|
banner: form.banner,
|
|
bannerGradient: form.gradient,
|
|
descriptionShow: form.description,
|
|
textColor: form.textPrimary ?? defaultColors[form.selectedTheme]['--header-text-primary']!,
|
|
metaColor: form.textSecondary ?? defaultColors[form.selectedTheme]['--header-text-secondary']!,
|
|
bgColor: form.bgColor ?? defaultColors[form.selectedTheme]['--header-background-color']!,
|
|
name: form.selectedTheme,
|
|
};
|
|
themeStore.setTheme(themeToSet);
|
|
});
|
|
|
|
const items = [
|
|
{ value: 'white', label: 'Light' },
|
|
{ value: 'black', label: 'Dark' },
|
|
{ value: 'azure', label: 'Azure' },
|
|
{ value: 'gray', label: 'Gray' },
|
|
];
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex flex-col gap-2 border-solid border-2 p-2 border-r-2">
|
|
<h1 class="text-lg">Color Theme Customization</h1>
|
|
|
|
<Label for="theme-select">Theme</Label>
|
|
<Select v-model="form.selectedTheme" :items="items" placeholder="Select a theme" />
|
|
|
|
<Label for="primary-text-color">Header Primary Text Color</Label>
|
|
<Input id="primary-text-color" v-model="form.textPrimary" />
|
|
|
|
<Label for="secondary-text-color">Header Secondary Text Color</Label>
|
|
<Input id="secondary-text-color" v-model="form.textSecondary" />
|
|
|
|
<Label for="background-color">Header Background Color</Label>
|
|
<Input id="background-color" v-model="form.bgColor" />
|
|
|
|
<Label for="gradient">Gradient</Label>
|
|
<Switch id="gradient" v-model:checked="form.gradient" />
|
|
|
|
<Label for="description">Description</Label>
|
|
<Switch id="description" v-model:checked="form.description" />
|
|
|
|
<Label for="banner">Banner</Label>
|
|
<Switch id="banner" v-model:checked="form.banner" />
|
|
</div>
|
|
</template>
|