The Counter and Slider problem has been solved
parent
bb50eabb35
commit
eb3f3a3f99
|
|
@ -70,6 +70,7 @@ export default function Landing() {
|
||||||
delay: 2500,
|
delay: 2500,
|
||||||
disableOnInteraction: false,
|
disableOnInteraction: false,
|
||||||
}}
|
}}
|
||||||
|
// autoplay={ data?.length > 1 ? { delay: 2500, disableOnInteraction: false } : false }
|
||||||
loop={false}
|
loop={false}
|
||||||
pagination={{
|
pagination={{
|
||||||
clickable: true,
|
clickable: true,
|
||||||
|
|
@ -94,7 +95,7 @@ export default function Landing() {
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{data?.length == 1 && (
|
{/* {data?.length == 1 && (
|
||||||
<SwiperSlide>
|
<SwiperSlide>
|
||||||
<Image
|
<Image
|
||||||
alt="bg"
|
alt="bg"
|
||||||
|
|
@ -106,7 +107,7 @@ export default function Landing() {
|
||||||
className=" w-full h-full object-cover max-sm:object-[70%]"
|
className=" w-full h-full object-cover max-sm:object-[70%]"
|
||||||
/>
|
/>
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
)}
|
)} */}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,14 @@ export default function RequestStep2() {
|
||||||
setCharCount(form.watch("description").length);
|
setCharCount(form.watch("description").length);
|
||||||
}, [form.watch("description")]);
|
}, [form.watch("description")]);
|
||||||
|
|
||||||
|
function handleDescriptionChange(event: React.ChangeEvent<HTMLTextAreaElement>) {
|
||||||
|
const newCharCount = event.target.value.length;
|
||||||
|
// Update charCount only when the user types or removes characters
|
||||||
|
if (newCharCount <= 1024) {
|
||||||
|
setCharCount(newCharCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onSubmit(data: z.infer<typeof FormSchema>) {
|
function onSubmit(data: z.infer<typeof FormSchema>) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
@ -353,6 +361,16 @@ export default function RequestStep2() {
|
||||||
placeholder=" توضیحات خود را بنویسید"
|
placeholder=" توضیحات خود را بنویسید"
|
||||||
className="mb-3 resize-none"
|
className="mb-3 resize-none"
|
||||||
{...field}
|
{...field}
|
||||||
|
onChange={(e) => {
|
||||||
|
const currentValue = e.target.value;
|
||||||
|
if (currentValue.length <= 1024) {
|
||||||
|
field.onChange(e);
|
||||||
|
handleDescriptionChange(e);
|
||||||
|
} else {
|
||||||
|
// Truncate the value to the allowed limit
|
||||||
|
field.onChange(currentValue.substring(0, 1024));
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue