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

@@ -107,7 +107,7 @@ describe("Course Creation", () => {
cy.get("div").contains( cy.get("div").contains(
"Test Course Short Introduction to test the UI" "Test Course Short Introduction to test the UI"
); );
cy.get(".course-image") cy.get(".bg-cover")
.invoke("css", "background-image") .invoke("css", "background-image")
.should("include", "/files/profile"); .should("include", "/files/profile");
}); });

View File

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

View File

@@ -5,7 +5,7 @@
style="min-height: 350px" style="min-height: 350px"
> >
<div <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=" :style="
course.image course.image
? { backgroundImage: `url('${encodeURI(course.image)}')` } ? { backgroundImage: `url('${encodeURI(course.image)}')` }

View File

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

View File

@@ -276,7 +276,7 @@
{ {
"fieldname": "card_gradient", "fieldname": "card_gradient",
"fieldtype": "Select", "fieldtype": "Select",
"label": "Card Gradient", "label": "Color",
"options": "Red\nBlue\nGreen\nAmber\nCyan\nOrange\nPink\nPurple\nTeal\nViolet\nYellow\nGray" "options": "Red\nBlue\nGreen\nAmber\nCyan\nOrange\nPink\nPurple\nTeal\nViolet\nYellow\nGray"
} }
], ],
@@ -296,7 +296,7 @@
} }
], ],
"make_attachments_public": 1, "make_attachments_public": 1,
"modified": "2025-07-25 17:30:48.553707", "modified": "2025-07-25 17:50:44.983391",
"modified_by": "sayali@frappe.io", "modified_by": "sayali@frappe.io",
"module": "LMS", "module": "LMS",
"name": "LMS Course", "name": "LMS Course",

View File

@@ -25,7 +25,7 @@
}, },
"homepage": "https://github.com/frappe/lms#readme", "homepage": "https://github.com/frappe/lms#readme",
"devDependencies": { "devDependencies": {
"cypress": "^13.9.0", "cypress": "^14.5.2",
"cypress-file-upload": "^5.0.8", "cypress-file-upload": "^5.0.8",
"cypress-real-events": "^1.14.0" "cypress-real-events": "^1.14.0"
}, },

1374
yarn.lock Normal file

File diff suppressed because it is too large Load Diff