fix: color swatch input style

This commit is contained in:
Jannat Patel
2025-07-25 18:30:58 +05:30
parent 01794a47c6
commit d8ce88ab57
7 changed files with 1423 additions and 39 deletions

View File

@@ -3,39 +3,43 @@
<div class="text-xs text-ink-gray-5 mb-1">
{{ __(label) }}
</div>
<Popover placement="bottom">
<Popover placement="bottom" class="!block">
<template #target="{ togglePopover, isOpen }">
<FormControl
type="text"
autocomplete="off"
class="[&>div>input]:pl-8"
:placeholder="__('Set Color')"
@focus="togglePopover"
:modelValue="modelValue"
@update:modelValue="(val: string) => emit('update:modelValue', val)"
>
<template #prefix>
<div
class="size-4 rounded-full"
:style="
modelValue
? {
backgroundColor:
theme.backgroundColor[modelValue.toLowerCase()][400],
}
: {}
"
></div>
</template>
<template #suffix>
<Button variant="ghost">
<X
class="size-3 text-ink-gray-5"
@click="emit('update:modelValue', null)"
/>
</Button>
</template>
</FormControl>
<div class="space-y-2">
<FormControl
type="text"
autocomplete="off"
class="w-full"
:placeholder="__('Set Color')"
@focus="togglePopover"
:modelValue="modelValue"
@update:modelValue="(val: string) => emit('update:modelValue', val)"
>
<template #prefix>
<div
class="size-4 rounded-full"
:style="
modelValue
? {
backgroundColor:
theme.backgroundColor[modelValue.toLowerCase()][400],
}
: {}
"
>
<Palette v-if="!modelValue" class="size-4 stroke-1.5 text-ink-gray-5" />
</div>
</template>
<template #suffix>
<Button variant="ghost">
<X
class="size-3 text-ink-gray-5"
@click="emit('update:modelValue', null)"
/>
</Button>
</template>
</FormControl>
</div>
</template>
<template #body="{ close }">
<div class="rounded-lg bg-surface-white p-3 border w-fit mt-2">
@@ -63,12 +67,15 @@
</div>
</template>
</Popover>
<div class="text-sm text-ink-gray-5 mt-2">
{{ description }}
</div>
</div>
</template>
<script setup lang="ts">
import { Button, FormControl, Popover } from 'frappe-ui'
import { computed } from 'vue'
import { X } from 'lucide-vue-next'
import { Palette, X } from 'lucide-vue-next'
import { theme } from '@/utils/theme'
const emit = defineEmits(['update:modelValue', 'change'])
@@ -76,6 +83,7 @@ const emit = defineEmits(['update:modelValue', 'change'])
const props = defineProps<{
modelValue: string
label: string
description?: string
}>()
const colors = computed(() => {

View File

@@ -5,7 +5,7 @@
style="min-height: 350px"
>
<div
class="w-[100%] h-[168px] bg-cover bg-center bg-no-repeat rounded-t-md"
class="w-[100%] h-[168px] bg-cover bg-center bg-no-repeat"
:style="
course.image
? { backgroundImage: `url('${encodeURI(course.image)}')` }

View File

@@ -130,7 +130,9 @@
<ColorSwatches
v-model="course.card_gradient"
:label="__('Card Gradient')"
:label="__('Color')"
:description="__('Choose a color for the course card')"
class="w-full"
/>
</div>
</div>