fix: improve handling of empty number input for the rating field in CMS.
This commit is contained in:
@@ -629,7 +629,7 @@ export default function CmsPage() {
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div>
|
||||
<label className="block text-xs text-[#666666] mb-0.5">Rating</label>
|
||||
<input type="number" min={1} max={5} step={0.1} className={inputCls} value={item.rating} onChange={(e) => updateTestimonial(idx, { rating: parseFloat(e.target.value) || 0 })} />
|
||||
<input type="number" min={1} max={5} step={0.1} className={inputCls} value={item.rating || ''} onChange={(e) => updateTestimonial(idx, { rating: e.target.value === '' ? 0 : parseFloat(e.target.value) })} />
|
||||
</div>
|
||||
<div>
|
||||
<label className="block text-xs text-[#666666] mb-0.5">Title</label>
|
||||
|
||||
Reference in New Issue
Block a user