You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/components/SupportUsButton.tsx
+38-22Lines changed: 38 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,9 @@ function getButtonClasses(buttonVariant: ButtonVariant): string {
49
49
}
50
50
51
51
// Main component function that renders the support us button, taking in various props for customization and rendering different sections such as hero, organization information, sponsors, and call-to-action based on the provided data and selected theme and button variant
52
-
functionSupportUsButton({
52
+
functionSupportUsButton(
53
+
54
+
{
53
55
Theme ="AOSSIE",
54
56
pattern ="AOSSIE",
55
57
hero ={
@@ -70,8 +72,23 @@ function SupportUsButton({
70
72
},
71
73
buttonVariant ="AOSSIE",
72
74
}: supportUsButtonProps): React.JSX.Element{
75
+
// Ensure required props are provided to prevent runtime crashes
73
76
77
+
if(!organizationInformation){
78
+
console.warn(
79
+
"SupportUsButton: 'organizationInformation' is required."
80
+
);
81
+
}
82
+
83
+
if(!ctaSection){
84
+
console.warn(
85
+
"SupportUsButton: 'ctaSection' is required."
86
+
);
87
+
}
74
88
89
+
// Defensive fallback to handle unexpected missing props at runtime
90
+
constorg=organizationInformation??null;
91
+
constcta=ctaSection??null;
75
92
return(
76
93
// Container for the support us button, with dynamic classes based on the selected theme and custom class names
77
94
<div
@@ -132,7 +149,7 @@ function SupportUsButton({
132
149
133
150
{/* Organization information section */}
134
151
{/* Avoid rendering empty organization section when data is not provided */}
0 commit comments