Add vuestic for form
This commit is contained in:
+3
-1
@@ -14,10 +14,12 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/vite": "^4.0.17",
|
"@tailwindcss/vite": "^4.0.17",
|
||||||
|
"@vuestic/tailwind": "^0.1.5",
|
||||||
"pinia": "^3.0.1",
|
"pinia": "^3.0.1",
|
||||||
"pinia-plugin-persistedstate": "^4.2.0",
|
"pinia-plugin-persistedstate": "^4.2.0",
|
||||||
"tailwindcss": "^4.0.17",
|
"tailwindcss": "^4.0.17",
|
||||||
"vue": "^3.5.13"
|
"vue": "^3.5.13",
|
||||||
|
"vuestic-ui": "^1.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node22": "^22.0.0",
|
"@tsconfig/node22": "^22.0.0",
|
||||||
|
|||||||
+42
-43
@@ -3,6 +3,16 @@ import Card from '@/components/card.vue'
|
|||||||
import { type CardT, type Preset, presets, validPreset } from '@/colors.ts'
|
import { type CardT, type Preset, presets, validPreset } from '@/colors.ts'
|
||||||
import { useCards } from '@/stores/cards.ts'
|
import { useCards } from '@/stores/cards.ts'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import {
|
||||||
|
VaButton,
|
||||||
|
VaButtonGroup,
|
||||||
|
VaCard,
|
||||||
|
VaCardContent,
|
||||||
|
VaColorInput,
|
||||||
|
VaCounter,
|
||||||
|
VaDivider,
|
||||||
|
VaInput,
|
||||||
|
} from 'vuestic-ui'
|
||||||
|
|
||||||
const cardStore = useCards()
|
const cardStore = useCards()
|
||||||
function presetChange(card: CardT, preset: keyof typeof presets | 'none') {
|
function presetChange(card: CardT, preset: keyof typeof presets | 'none') {
|
||||||
@@ -11,7 +21,6 @@ function presetChange(card: CardT, preset: keyof typeof presets | 'none') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const values = presets[preset]
|
const values = presets[preset]
|
||||||
console.log(values)
|
|
||||||
Object.keys(values).forEach((key) => (card[key as keyof Preset] = values[key as keyof Preset]))
|
Object.keys(values).forEach((key) => (card[key as keyof Preset] = values[key as keyof Preset]))
|
||||||
}
|
}
|
||||||
const active = ref(-1)
|
const active = ref(-1)
|
||||||
@@ -20,59 +29,49 @@ const active = ref(-1)
|
|||||||
<template>
|
<template>
|
||||||
<div class="grid grid-cols-3">
|
<div class="grid grid-cols-3">
|
||||||
<div class="noPrint flex flex-col gap-3 border-r-4 bg-gray-100 mr-4 h-screen overflow-y-auto">
|
<div class="noPrint flex flex-col gap-3 border-r-4 bg-gray-100 mr-4 h-screen overflow-y-auto">
|
||||||
<div
|
<VaCard
|
||||||
v-for="(card, i) in cardStore.cards"
|
v-for="(card, i) in cardStore.cards"
|
||||||
:key="i"
|
:key="i"
|
||||||
class="p-3 bg-gray-300 flex flex-col gap-1 m-2 mr-0 border-2 border-gray-200 hover:border-gray-800 transition-colors"
|
class="m-3"
|
||||||
@mouseover="active = i"
|
@mouseover="active = i"
|
||||||
@mouseleave="active = -1"
|
@mouseleave="active = -1"
|
||||||
|
stripe
|
||||||
|
:stripe-color="active === i ? 'success' : card.bgColor"
|
||||||
>
|
>
|
||||||
<input v-model="card.title" placeholder="Title" />
|
<VaCardContent class="flex flex-col gap-4">
|
||||||
<div class="flex flex-row gap-2">
|
<VaInput v-model="card.title" label="Title" clearable />
|
||||||
<input
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
|
||||||
v-model="card.bgColor"
|
<VaInput v-model="card.name" label="Name" class="col-span-2" clearable />
|
||||||
placeholder="Title Background Color"
|
<VaCounter
|
||||||
title="Title Background Color"
|
|
||||||
type="color"
|
|
||||||
class="h-16"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
v-model="card.textColor"
|
|
||||||
placeholder="Title Text Color"
|
|
||||||
title="Title Text Color"
|
|
||||||
type="color"
|
|
||||||
class="h-16"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
v-model="card.color"
|
|
||||||
placeholder="Background Color"
|
|
||||||
title="Background Color"
|
|
||||||
type="color"
|
|
||||||
class="h-16"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
v-model="card.nameColor"
|
|
||||||
placeholder="Name Text Color"
|
|
||||||
title="Name Text Color"
|
|
||||||
type="color"
|
|
||||||
class="h-16"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
v-model="card.textSize"
|
v-model="card.textSize"
|
||||||
type="number"
|
type="number"
|
||||||
min="1"
|
min="1"
|
||||||
max="10"
|
max="10"
|
||||||
placeholder="Name Text Size"
|
label="Name Text Size"
|
||||||
title="Name Text Size"
|
|
||||||
/>
|
/>
|
||||||
<select @change="(e) => presetChange(card, (e.target as any)!.value)" title="Preset">
|
</div>
|
||||||
<option v-for="(preset, key) in presets" :key="key" :value="key">
|
<VaDivider />
|
||||||
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||||
|
<VaColorInput v-model="card.bgColor" label="Title Background Color" />
|
||||||
|
<VaColorInput v-model="card.textColor" label="Title Text Color" />
|
||||||
|
<VaColorInput v-model="card.color" label="Background Color" />
|
||||||
|
<VaColorInput v-model="card.nameColor" label="Name Text Color" />
|
||||||
|
</div>
|
||||||
|
<VaDivider />
|
||||||
|
<h3 class="text-lg font-bold uppercase text-center">Apply a preset:</h3>
|
||||||
|
<VaButtonGroup class="mx-auto">
|
||||||
|
<VaButton
|
||||||
|
v-for="(preset, key) in presets"
|
||||||
|
:key="key"
|
||||||
|
:value="key"
|
||||||
|
:color="preset.bgColor"
|
||||||
|
@click="presetChange(card, key)"
|
||||||
|
>
|
||||||
{{ preset.title }}
|
{{ preset.title }}
|
||||||
</option>
|
</VaButton>
|
||||||
</select>
|
</VaButtonGroup>
|
||||||
</div>
|
</VaCardContent>
|
||||||
<input v-model="card.name" placeholder="Name" />
|
</VaCard>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 grid grid-cols-2 page gap-2 h-screen overflow-y-auto">
|
<div class="col-span-2 grid grid-cols-2 page gap-2 h-screen overflow-y-auto">
|
||||||
<card
|
<card
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@import 'https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400;1,700&display=swap';
|
||||||
|
@import 'https://fonts.googleapis.com/icon?family=Material+Icons';
|
||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
.card {
|
.card {
|
||||||
width: 9cm;
|
width: 9cm;
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ export const presets = {
|
|||||||
nameColor: '#000000',
|
nameColor: '#000000',
|
||||||
title: 'Fachschaft 4',
|
title: 'Fachschaft 4',
|
||||||
},
|
},
|
||||||
|
helping: {
|
||||||
|
bgColor: '#383838',
|
||||||
|
color: '#ffffff',
|
||||||
|
textColor: '#ffffff',
|
||||||
|
nameColor: '#000000',
|
||||||
|
title: 'Helping Hand',
|
||||||
|
},
|
||||||
awareness: {
|
awareness: {
|
||||||
bgColor: '#3e1c59',
|
bgColor: '#3e1c59',
|
||||||
color: '#6f309f',
|
color: '#6f309f',
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const props = defineProps<{
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="flex flex-col border-2 border-gray-200 transition-colors card mx-auto w-full"
|
class="flex flex-col border-2 border-gray-200 transition-colors card mx-auto w-full"
|
||||||
:class="{ 'border-gray-800': active }"
|
:class="{ 'border-red-800': active }"
|
||||||
:style="{ backgroundColor: card.color }"
|
:style="{ backgroundColor: card.color }"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
+4
-1
@@ -4,7 +4,10 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||||
|
import { createVuestic } from 'vuestic-ui'
|
||||||
|
import 'vuestic-ui/styles/essential.css'
|
||||||
|
import 'vuestic-ui/styles/typography.css'
|
||||||
|
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
|
|
||||||
createApp(App).use(pinia.use(piniaPluginPersistedstate)).mount('#app')
|
createApp(App).use(pinia.use(piniaPluginPersistedstate)).use(createVuestic()).mount('#app')
|
||||||
|
|||||||
Reference in New Issue
Block a user