@codesinger0/shared-components 1.1.39 → 1.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -84,11 +84,14 @@ const OrderForm = ({
|
|
|
84
84
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
85
85
|
const [errors, setErrors] = useState({});
|
|
86
86
|
|
|
87
|
+
const localScrollContainerRef = useRef(null);
|
|
88
|
+
const activeScrollContainerRef = scrollContainerRef || localScrollContainerRef;
|
|
89
|
+
|
|
87
90
|
const scrollToAnchor = (fieldName) => {
|
|
88
91
|
// Small delay to ensure error messages are rendered
|
|
89
92
|
setTimeout(() => {
|
|
90
93
|
const element = document.getElementById(`${fieldName}`);
|
|
91
|
-
const container =
|
|
94
|
+
const container = activeScrollContainerRef.current;
|
|
92
95
|
|
|
93
96
|
if (element && container) {
|
|
94
97
|
// Get element position relative to container
|
|
@@ -498,7 +501,11 @@ const OrderForm = ({
|
|
|
498
501
|
const grandTotal = discountedSubtotal + deliveryCost;
|
|
499
502
|
|
|
500
503
|
return (
|
|
501
|
-
<div
|
|
504
|
+
<div
|
|
505
|
+
ref={scrollContainerRef ? null : localScrollContainerRef}
|
|
506
|
+
className={scrollContainerRef ? "min-h-screen bg-main py-12 px-4" : "h-screen overflow-y-auto bg-main py-12 px-4"}
|
|
507
|
+
dir="rtl"
|
|
508
|
+
>
|
|
502
509
|
<div className="max-w-2xl mx-auto">
|
|
503
510
|
|
|
504
511
|
{/* Back Button */}
|