fix values
This commit is contained in:
@@ -95,47 +95,46 @@ const AttributesModal: FC<AttributesModalProps> = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{newAttribute.type === 'select' && (
|
<div className="space-y-3">
|
||||||
<div className="space-y-3">
|
<label className="text-sm font-medium">
|
||||||
<label className="text-sm font-medium">مقادیر قابل انتخاب</label>
|
مقادیر قابل انتخاب {newAttribute.type === 'select' ? '(اجباری)' : '(اختیاری)'}
|
||||||
<div className="flex gap-2 items-center">
|
</label>
|
||||||
<Input
|
<div className="flex gap-2 items-center">
|
||||||
placeholder="مقدار جدید اضافه کنید"
|
<Input
|
||||||
value={newValue}
|
placeholder="مقدار جدید اضافه کنید"
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNewValue(e.target.value)}
|
value={newValue}
|
||||||
onKeyPress={(e) => e.key === 'Enter' && handleAddValue()}
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNewValue(e.target.value)}
|
||||||
/>
|
onKeyPress={(e) => e.key === 'Enter' && handleAddValue()}
|
||||||
<Button
|
/>
|
||||||
onClick={handleAddValue}
|
<Button
|
||||||
variant="outline"
|
onClick={handleAddValue}
|
||||||
// size="sm"
|
variant="outline"
|
||||||
disabled={!newValue.trim()}
|
disabled={!newValue.trim()}
|
||||||
className='w-fit mt-1'
|
className='w-fit mt-1'
|
||||||
>
|
>
|
||||||
<Add size={16} color='#000' />
|
<Add size={16} color='#000' />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
|
||||||
{newAttribute.values.length > 0 && (
|
|
||||||
<div className="space-y-2 flex gap-3 items-center flex-wrap max-h-32 overflow-y-auto">
|
|
||||||
{newAttribute.values.map((value, index) => (
|
|
||||||
<div key={index} className="flex min-w-[30%] flex-1 items-center justify-between bg-gray-50 p-2 rounded">
|
|
||||||
<div className="text-sm">{value.text}</div>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => onRemoveValue(index)}
|
|
||||||
className="text-red-500 w-fit hover:text-red-700"
|
|
||||||
>
|
|
||||||
<Trash color='red' size={20} />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
<div className='min-w-[30%] flex-1 px-2'></div>
|
|
||||||
<div className='min-w-[30%] flex-1 px-2'></div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
{newAttribute.values.length > 0 && (
|
||||||
|
<div className="space-y-2 flex gap-3 items-center flex-wrap max-h-32 overflow-y-auto">
|
||||||
|
{newAttribute.values.map((value, index) => (
|
||||||
|
<div key={index} className="flex min-w-[30%] flex-1 items-center justify-between bg-gray-50 p-2 rounded">
|
||||||
|
<div className="text-sm">{value.text}</div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => onRemoveValue(index)}
|
||||||
|
className="text-red-500 w-fit hover:text-red-700"
|
||||||
|
>
|
||||||
|
<Trash color='red' size={20} />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div className='min-w-[30%] flex-1 px-2'></div>
|
||||||
|
<div className='min-w-[30%] flex-1 px-2'></div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-3 pt-4 border-t border-border">
|
<div className="flex gap-3 pt-4 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user