Skip to content

Commit c9bab8f

Browse files
committed
slider glitch fix
Signed-off-by: Naman Verma <149177973+Namanv0509@users.noreply.github.com>
1 parent 4e8db8f commit c9bab8f

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/components/PlanCard/collapsible-details.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,14 @@ const FeatureDetailsWrapper = styled.div`
6565
}
6666
`;
6767

68-
const FeatureDetails = ({ category, description, tier, children }) => {
68+
const FeatureDetails = ({ category, description, tier, children, onToggle }) => {
6969
const [expand, setExpand] = React.useState(false);
7070

71+
// Call onToggle when expand changes
72+
React.useEffect(() => {
73+
onToggle?.(expand);
74+
}, [expand, onToggle]);
75+
7176
const BetaTag = () => <span className="beta-tag">Coming Soon</span>;
7277

7378
return (
@@ -76,15 +81,9 @@ const FeatureDetails = ({ category, description, tier, children }) => {
7681
{(description || children) && (
7782
<div className="toggle-btn">
7883
{expand ? (
79-
<MdExpandMore
80-
className="toggle-icon"
81-
onClick={() => setExpand(!expand)}
82-
/>
84+
<MdExpandMore className="toggle-icon" />
8385
) : (
84-
<RiArrowRightSLine
85-
className="toggle-icon"
86-
onClick={() => setExpand(!expand)}
87-
/>
86+
<RiArrowRightSLine className="toggle-icon" />
8887
)}
8988
</div>
9089
)}
@@ -94,9 +93,7 @@ const FeatureDetails = ({ category, description, tier, children }) => {
9493
</h5>
9594
<div className="details">
9695
{description && (
97-
<p className={`closed ${expand ? "open" : ""}`}
98-
dangerouslySetInnerHTML={{ __html: description }}>
99-
</p>
96+
<p className={`closed ${expand ? "open" : ""}`} dangerouslySetInnerHTML={{ __html: description }} />
10097
)}
10198
{children && (
10299
<div className={`closed ${expand ? "open" : ""}`}>
@@ -109,4 +106,4 @@ const FeatureDetails = ({ category, description, tier, children }) => {
109106
);
110107
};
111108

112-
export default FeatureDetails;
109+
export default FeatureDetails;

0 commit comments

Comments
 (0)