Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5639952
Update mobile-swiper.style.js
Lakshay-Pareek Aug 27, 2025
e29dc2b
Update mobile-swiper.style.js
Lakshay-Pareek Aug 28, 2025
75cb3c1
Update mobile-swiper.style.js
Lakshay-Pareek Aug 28, 2025
bc8c275
Update mobile-swiper.style.js
Lakshay-Pareek Aug 28, 2025
9bb0aeb
Update mobile-swiper.style.js
Lakshay-Pareek Aug 28, 2025
e8aa06c
Update mobile-swiper.style.js
Lakshay-Pareek Aug 28, 2025
3c65d72
Update mobile-swiper.style.js
Lakshay-Pareek Sep 1, 2025
ce6db17
Update mobile-swiper.style.js
Lakshay-Pareek Sep 1, 2025
b37f109
Update mobile-swiper.style.js
Lakshay-Pareek Sep 1, 2025
710b78e
Add custom styles and properties to CurrencySelect menu for improved UX
darshitdudhaiya Oct 9, 2025
64bae66
fix: currency selector dropdown
darshitdudhaiya Oct 9, 2025
496baba
feat: close CurrencySelect dropdown when it leaves the viewport using…
darshitdudhaiya Oct 10, 2025
fab7464
removed unused compponets and cleanup
saurabhraghuvanshii Oct 8, 2025
aa62f51
Update Catalog Docs
traitor09 Oct 10, 2025
89eb87c
Create AGENTS.md for AI agent guidance
leecalcote Oct 10, 2025
93bb693
add image
leecalcote Oct 10, 2025
f739cf2
hyphen
leecalcote Oct 10, 2025
a250441
quotes
leecalcote Oct 10, 2025
0094dcf
feat: add badges from layer5 cloud to recognition handbook
RashRAJ Oct 9, 2025
bbd717a
fix: Update header for dark mode
RashRAJ Oct 9, 2025
8c2caf0
fix: update project badges style
RashRAJ Oct 10, 2025
bf8e82c
Merge branch 'master' into bug-fix/currency-selector-dropdown
darshitdudhaiya Oct 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sections/Pricing/feature_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@
"teamOperator": "x",
"enterprise": "x"
},
"docs": ""
"docs": "https://docs.layer5.io/cloud/catalog/exploring-the-catalog/"
},
{
"theme": "",
Expand Down Expand Up @@ -1183,4 +1183,4 @@
},
"docs": ""
}
]
]
92 changes: 88 additions & 4 deletions src/sections/Pricing/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState, useRef, useEffect } from "react";
import PricingWrapper from "./pricing.style";
import Comparison from "./comparison";
import FAQ from "../General/Faq";
Expand Down Expand Up @@ -42,8 +42,72 @@ const getCustomToggleButtonStyle = (isActive, baseStyle) => ({
});

export const CurrencySelect = ({ currency, setCurrency }) => {
const [open, setOpen] = useState(false);

const containerRef = useRef(null);
const toggleRef = useRef(null);

useEffect(() => {
if (!open) return;

const el = toggleRef.current ?? containerRef.current;
if (!el) return;

if ("IntersectionObserver" in window) {
const observer = new IntersectionObserver(
(entries) => {
entries.forEach((entry) => {
if (!entry.isIntersecting) {
setOpen(false);
}
});
},
{ root: null, threshold: 0.1 }
);

observer.observe(el);
return () => observer.disconnect();
}

let ticking = false;
const checkRect = () => {
const currentEl = toggleRef.current ?? containerRef.current;
if (!currentEl) return;

const rect = currentEl.getBoundingClientRect();
const isOutOfView =
rect.bottom < 0 ||
rect.top > window.innerHeight ||
rect.right < 0 ||
rect.left > window.innerWidth;

if (isOutOfView) {
setOpen(false);
}
};

const onScroll = () => {
if (!ticking) {
ticking = true;
window.requestAnimationFrame(() => {
checkRect();
ticking = false;
});
}
};

window.addEventListener("scroll", onScroll, { passive: true, capture: true });
window.addEventListener("resize", checkRect, { passive: true });

return () => {
window.removeEventListener("scroll", onScroll, { capture: true });
window.removeEventListener("resize", checkRect);
};
}, [open]);

return (
<FormControl
ref={containerRef}
variant="outlined"
size="small"
sx={{
Expand All @@ -70,19 +134,38 @@ export const CurrencySelect = ({ currency, setCurrency }) => {
}}
>
<InputLabel id="currency-selector-label">Currency</InputLabel>

<Select
ref={toggleRef}
labelId="currency-selector-label"
value={currency}
onChange={(e) => {
setCurrency(e.target.value);
}}
open={open}
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
onChange={(e) => setCurrency(e.target.value)}
label="Currency"
renderValue={(value) => (
<Box sx={{ display: "flex", alignItems: "center", gap: 1, color: "#fff" }}>
<Typography variant="body1">{Currencies[value]?.symbol}</Typography>
<Typography variant="body2">{Currencies[value]?.name}</Typography>
</Box>
)}
MenuProps={{
disablePortal: true,
disableScrollLock: true,
PaperProps: {
sx: {
backgroundColor: "#1E1E1E",
color: "white",
maxHeight: 300,
overflowY: "auto",
position: "absolute",
},
},
anchorOrigin: { vertical: "bottom", horizontal: "left" },
transformOrigin: { vertical: "top", horizontal: "left" },
marginThreshold: 0,
}}
>
{Object.entries(Currencies).map(([code, { symbol, name }]) => (
<MenuItem key={code} value={code}>
Expand All @@ -97,6 +180,7 @@ export const CurrencySelect = ({ currency, setCurrency }) => {
);
};


const Pricing = () => {
// const [monthly, setMonthly] = useState(false);
const [isYearly, setIsYearly] = useState(false);
Expand Down