Skip to content

Commit 01f89b1

Browse files
committed
Merge branch 'leecalcote/pricing-addons' of https://github.com/layer5io/layer5 into leecalcote/pricing-addons
Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
2 parents 44eaf9d + 5f7998e commit 01f89b1

1 file changed

Lines changed: 26 additions & 15 deletions

File tree

src/components/PricingAddons/index.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import { useStyledDarkMode } from "../../theme/app/useStyledDarkMode";
77
import FeatureDetails from "../PlanCard/collapsible-details";
88
import PlanCardWrapper from "../PlanCard/planCard.style";
99

10+
const learnerOptions = [
11+
{ learners: 0, monthlyPerUser: 0 },
12+
{ learners: 50, monthlyPerUser: 1.73 },
13+
{ learners: 150, monthlyPerUser: 1.73 },
14+
{ learners: 250, monthlyPerUser: 1.38 },
15+
{ learners: 500, monthlyPerUser: 0.87 },
16+
{ learners: 1000, monthlyPerUser: 0.59 },
17+
];
18+
1019
const addOns = [
1120
{
1221
id: "academy",
@@ -59,6 +68,7 @@ export const PricingAddons = ({ isYearly = false }) => {
5968
const [quantity, setQuantity] = useState(1);
6069
const [labLearners, setLabLearners] = useState(false);
6170
const [totalPrice, setTotalPrice] = useState(0);
71+
const [quantityIndex, setQuantityIndex] = useState(0);
6272

6373
useEffect(() => {
6474
if (selectedAddon) {
@@ -78,9 +88,6 @@ export const PricingAddons = ({ isYearly = false }) => {
7888
setQuantity(1);
7989
};
8090

81-
const handleQuantityChange = (_, newValue) => {
82-
setQuantity(Array.isArray(newValue) ? newValue[0] : newValue);
83-
};
8491

8592
const formatPrice = (price) => {
8693
return new Intl.NumberFormat("en-US", {
@@ -94,8 +101,9 @@ export const PricingAddons = ({ isYearly = false }) => {
94101
return (
95102
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
96103
<CssBaseline />
97-
<PlanCardWrapper>
98-
<Container maxWidth="lg" sx={{ my: 4 }}>
104+
105+
<Container maxWidth="lg" sx={{ my: 4 }}>
106+
<PlanCardWrapper>
99107
<Card
100108
elevation={0}
101109
sx={{
@@ -205,13 +213,15 @@ export const PricingAddons = ({ isYearly = false }) => {
205213

206214
<Box sx={{ px: 1 }}>
207215
<Slider
208-
value={quantity}
209-
onChange={handleQuantityChange}
210-
min={1}
211-
max={selectedAddon.maxUnits}
212-
step={1}
213-
valueLabelDisplay="auto"
214-
sx={{ mb: 2 }}
216+
value={quantityIndex}
217+
onChange={(event, newValue) => setQuantityIndex(newValue)}
218+
min={0}
219+
max={learnerOptions.length - 1}
220+
step={null}
221+
marks={learnerOptions.map((option, index) => ({
222+
value: index,
223+
label: option.learners === 1000 ? "1,000+" : option.learners,
224+
}))}
215225
/>
216226
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
217227
<Typography variant="body2" color="text.secondary">
@@ -330,13 +340,14 @@ export const PricingAddons = ({ isYearly = false }) => {
330340
</Box>
331341
</CardContent>
332342
</Card>
333-
</Container>
334-
{/* <Chip
343+
</PlanCardWrapper>
344+
</Container>
345+
{/* <Chip
335346
label={labLearners ? formatPrice(isYearly ? secondaryOptions[0].yearlyPrice : secondaryOptions[0].price) : "Hands-on Learning disabled"}
336347
color={labLearners ? "success" : "default"}
337348
sx={{ minWidth: 100 }}
338349
/> */}
339-
</PlanCardWrapper>
350+
340351
</SistentThemeProvider>
341352

342353
);

0 commit comments

Comments
 (0)