more
This commit is contained in:
@@ -41,7 +41,7 @@ const SignupPage = () => {
|
|||||||
const [activeRadioOption, setActiveRadioOption] = useState("monthlyBasic");
|
const [activeRadioOption, setActiveRadioOption] = useState("monthlyBasic");
|
||||||
const modalText = "Description of monthly and annual subscriptions";
|
const modalText = "Description of monthly and annual subscriptions";
|
||||||
const [selectedPlan, setSelectedPlan] = useState({});
|
const [selectedPlan, setSelectedPlan] = useState({});
|
||||||
const [annualizd, setAnualized] = useState(true);
|
const [isAnnualBilling, setIsAnnualBilling] = useState(false);
|
||||||
// Could also go in App.js if needed in the future
|
// Could also go in App.js if needed in the future
|
||||||
const stripe = new Stripe(stripeApiKey);
|
const stripe = new Stripe(stripeApiKey);
|
||||||
|
|
||||||
@@ -168,6 +168,10 @@ const SignupPage = () => {
|
|||||||
setShowSelectPlan(true);
|
setShowSelectPlan(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleToggle = () => {
|
||||||
|
setIsAnnualBilling(!isAnnualBilling);
|
||||||
|
};
|
||||||
|
|
||||||
async function handleStripeAuthorization(
|
async function handleStripeAuthorization(
|
||||||
user,
|
user,
|
||||||
paymentDataValues,
|
paymentDataValues,
|
||||||
@@ -387,7 +391,7 @@ const SignupPage = () => {
|
|||||||
<div className="plan-header-left">
|
<div className="plan-header-left">
|
||||||
<div className="select-toggle-box">
|
<div className="select-toggle-box">
|
||||||
<p className="select-billing-text">Billed annually</p>
|
<p className="select-billing-text">Billed annually</p>
|
||||||
<Toggle />
|
<Toggle onClick={handleToggle} />
|
||||||
<p className="select-billing-text">Billed montly</p>
|
<p className="select-billing-text">Billed montly</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -403,6 +407,7 @@ const SignupPage = () => {
|
|||||||
details={option.details}
|
details={option.details}
|
||||||
activeRadioOption={activeRadioOption}
|
activeRadioOption={activeRadioOption}
|
||||||
price={option.pricing}
|
price={option.pricing}
|
||||||
|
isAnnualBilling={isAnnualBilling}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ const Radio = (props) => {
|
|||||||
disabled,
|
disabled,
|
||||||
activeRadioOption,
|
activeRadioOption,
|
||||||
details,
|
details,
|
||||||
|
isAnnualBilling,
|
||||||
} = props;
|
} = props;
|
||||||
const classCheckbox = "checkbox";
|
const classCheckbox = "checkbox";
|
||||||
const classOption = "option";
|
const classOption = "option";
|
||||||
console.log("price", price);
|
const index = isAnnualBilling ? Number("1") : Number("0");
|
||||||
return (
|
return (
|
||||||
<div className="radio-container">
|
<div className="radio-container">
|
||||||
<div className="radio-option-container" key={name}>
|
<div className="radio-option-container" key={name}>
|
||||||
@@ -36,7 +37,10 @@ const Radio = (props) => {
|
|||||||
)}
|
)}
|
||||||
<div className="radio-name-box"> {`${name}`} </div>
|
<div className="radio-name-box"> {`${name}`} </div>
|
||||||
<div className="radio-price-box">
|
<div className="radio-price-box">
|
||||||
<div className="radio-price"> {`${price[1]["amount"]}`} </div>
|
<div className="radio-price">
|
||||||
|
{" "}
|
||||||
|
{`${price[index]["amount"]}`}{" "}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="radio-circle-lower">
|
<div className="radio-circle-lower">
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
import ToggleButton from "react-bootstrap/ToggleButton";
|
import ToggleButton from "react-bootstrap/ToggleButton";
|
||||||
import ToggleButtonGroup from "react-bootstrap/ToggleButtonGroup";
|
import ToggleButtonGroup from "react-bootstrap/ToggleButtonGroup";
|
||||||
|
|
||||||
function Toggle() {
|
const Toggle = (props) => {
|
||||||
|
const { onClick } = props;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ToggleButtonGroup type="radio" name="options" defaultValue={1}>
|
<ToggleButtonGroup type="radio" name="options" defaultValue={1}>
|
||||||
<ToggleButton id="tbg-radio-1" value={1}></ToggleButton>
|
<ToggleButton
|
||||||
<ToggleButton id="tbg-radio-2" value={2}></ToggleButton>
|
onClick={onClick}
|
||||||
|
id="tbg-radio-1"
|
||||||
|
value={1}
|
||||||
|
></ToggleButton>
|
||||||
|
<ToggleButton
|
||||||
|
onClick={onClick}
|
||||||
|
id="tbg-radio-2"
|
||||||
|
value={2}
|
||||||
|
></ToggleButton>
|
||||||
</ToggleButtonGroup>
|
</ToggleButtonGroup>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Toggle;
|
export default Toggle;
|
||||||
|
|||||||
Reference in New Issue
Block a user