This commit is contained in:
Kenneth Jannette
2024-01-25 14:32:01 -06:00
parent 48f9ea9cae
commit 275538583f
2 changed files with 46 additions and 39 deletions

View File

@@ -36,7 +36,7 @@ const SignupPage = () => {
); );
const [showPaymentModal, setShowPaymentModal] = useState(false); const [showPaymentModal, setShowPaymentModal] = useState(false);
const [showSelectPlan, setShowSelectPlan] = useState(true); const [showSelectPlan, setShowSelectPlan] = useState(true);
const [radioOption, setRadioOption] = useState(); const [activeRadioOption, setActiveRadioOption] = useState("monthlyBasic");
const modalText = "Description of monthly and annual subscriptions"; const modalText = "Description of monthly and annual subscriptions";
// this could also go in App.js if needed in the future // this could also go in App.js if needed in the future
@@ -68,10 +68,12 @@ const SignupPage = () => {
} }
}; };
const handleChangeRadioInput = (e, name) => { const handleChangeRadioInput = (name) => {
console.log("name", name.label); //console.log("name", name.label);
}; };
signupRadioFields.map((option) => {
console.log(option.value);
});
const validateData = () => { const validateData = () => {
const newData = getValidatedFormData(data, signupFields); const newData = getValidatedFormData(data, signupFields);
const hasErrors = isFormDataHasErrors(newData); const hasErrors = isFormDataHasErrors(newData);
@@ -217,8 +219,6 @@ const SignupPage = () => {
subscriptionId, subscriptionId,
customerId, customerId,
}; };
return !error;
} }
const handleSignup = async (e) => { const handleSignup = async (e) => {
@@ -373,9 +373,15 @@ const SignupPage = () => {
</h5> </h5>
</div> </div>
<div className="radio-group-box"> <div className="radio-group-box">
{signupRadioFields?.map((radio, i) => { {signupRadioFields?.map((option, i) => (
console.log("radio", radio); <Radio
})} option={option.name}
onClick={handleChangeRadioInput}
value={option.value}
name={option.name}
activeRadioOption={activeRadioOption}
/>
))}
</div> </div>
</div> </div>
<div className="select-sub-right"> <div className="select-sub-right">

View File

@@ -1,30 +1,41 @@
import { CircleFill, Circle } from "react-bootstrap-icons"; import { CircleFill, Circle } from "react-bootstrap-icons";
const Radio = (props) => { const Radio = (props) => {
const { console.log("hello");
className, const { name, onClick, value, disabled, activeRadioOption } = props;
classNames,
labelText,
title,
price,
ref,
onClick,
value,
options,
disabled,
} = props;
const classCheckbox = "checkbox"; const classCheckbox = "checkbox";
const classOption = "option"; const classOption = "option";
const foo = []; console.log("value, activeRadioOption", value, activeRadioOption);
return ( return (
<div> <div>
{options.map((option) => (
<div <div
className="option-container" className="radio-option-container"
key={option.name} key={name}
onClick={() => !disabled && onClick && onClick(option)} onClick={() => !disabled && onClick && onClick(name)}
> >
{value == option?.value ? ( {value == activeRadioOption ? (
<div className="radio-circle-container">
<div> {`checked: ${name}`} </div>
</div>
) : (
<div className="radio-circle-container">
<div> {`unchecked: ${name}`} </div>
</div>
)}
</div>
</div>
);
};
/**
* 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 ? (
<div className="circle-container"> <div className="circle-container">
<div> {option.name}</div> <div> {option.name}</div>
<CircleFill <CircleFill
@@ -59,17 +70,7 @@ const Radio = (props) => {
)} )}
</div> </div>
))} ))}
</div>
);
};
/**
* 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 &&
options?.length && options?.length &&
options.map((option, index) => ( options.map((option, index) => (