From 275538583fd1e4d4b8319e2a5ccadd964c8b7990 Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Thu, 25 Jan 2024 14:32:01 -0600 Subject: [PATCH] more --- src/Components/SignupPage/SignupPage.js | 24 ++++++---- src/pageElements/Radio.js | 61 +++++++++++++------------ 2 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/Components/SignupPage/SignupPage.js b/src/Components/SignupPage/SignupPage.js index ba6e2f9..db107f2 100644 --- a/src/Components/SignupPage/SignupPage.js +++ b/src/Components/SignupPage/SignupPage.js @@ -36,7 +36,7 @@ const SignupPage = () => { ); const [showPaymentModal, setShowPaymentModal] = useState(false); const [showSelectPlan, setShowSelectPlan] = useState(true); - const [radioOption, setRadioOption] = useState(); + const [activeRadioOption, setActiveRadioOption] = useState("monthlyBasic"); const modalText = "Description of monthly and annual subscriptions"; // this could also go in App.js if needed in the future @@ -68,10 +68,12 @@ const SignupPage = () => { } }; - const handleChangeRadioInput = (e, name) => { - console.log("name", name.label); + const handleChangeRadioInput = (name) => { + //console.log("name", name.label); }; - + signupRadioFields.map((option) => { + console.log(option.value); + }); const validateData = () => { const newData = getValidatedFormData(data, signupFields); const hasErrors = isFormDataHasErrors(newData); @@ -217,8 +219,6 @@ const SignupPage = () => { subscriptionId, customerId, }; - - return !error; } const handleSignup = async (e) => { @@ -373,9 +373,15 @@ const SignupPage = () => {
- {signupRadioFields?.map((radio, i) => { - console.log("radio", radio); - })} + {signupRadioFields?.map((option, i) => ( + + ))}
diff --git a/src/pageElements/Radio.js b/src/pageElements/Radio.js index 9551c69..45abd5a 100644 --- a/src/pageElements/Radio.js +++ b/src/pageElements/Radio.js @@ -1,30 +1,41 @@ import { CircleFill, Circle } from "react-bootstrap-icons"; const Radio = (props) => { - const { - className, - classNames, - labelText, - title, - price, - ref, - onClick, - value, - options, - disabled, - } = props; + console.log("hello"); + const { name, onClick, value, disabled, activeRadioOption } = props; const classCheckbox = "checkbox"; const classOption = "option"; - const foo = []; + console.log("value, activeRadioOption", value, activeRadioOption); return (
- {options.map((option) => ( -
!disabled && onClick && onClick(option)} - > - {value == option?.value ? ( +
!disabled && onClick && onClick(name)} + > + {value == activeRadioOption ? ( +
+
{`checked: ${name}`}
+
+ ) : ( +
+
{`unchecked: ${name}`}
+
+ )} +
+
+ ); +}; + +/** + * A radio button is a quick way to extract a single coded answer from our users by presenting multiple possibilities and allowing only one option to be chosen. + */ + +export default Radio; + +/* + +{value == option?.value ? (
{option.name}
{ )}
))} -
- ); -}; -/** - * A radio button is a quick way to extract a single coded answer from our users by presenting multiple possibilities and allowing only one option to be chosen. - */ - -export default Radio; - -/* {options && options?.length && options.map((option, index) => (