Skip to content

Commit ce1ca8d

Browse files
authored
Merge pull request #6737 from layer5io/leecalcote/final-pricing-addon
leecalcote/final pricing addon
2 parents b60f527 + b6e0eb5 commit ce1ca8d

12 files changed

Lines changed: 1869 additions & 53 deletions

File tree

src/components/PlanCard/collapsible-details.js

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,44 @@ const FeatureDetailsWrapper = styled.div`
77
display: inline;
88
cursor: pointer;
99
10-
.open {
11-
margin: 0rem;
12-
list-style: none;
13-
height: auto !important;
14-
opacity: 1 !important;
10+
.details > * {
11+
max-height: 0;
12+
opacity: 0;
13+
margin: 0;
14+
visibility: hidden;
15+
overflow: hidden;
16+
transition: opacity 0.2s ease-in-out,
17+
max-height 0.3s ease-in-out 0.1s,
18+
margin 0.3s ease-in-out 0.1s,
19+
visibility 0s linear 0.4s;
20+
}
21+
22+
.details > .open {
23+
max-height: 200px;
24+
opacity: 1;
1525
margin-bottom: 1rem;
16-
transition: all 0.4s !important;
26+
visibility: visible;
27+
transition: visibility 0s linear,
28+
opacity 0.2s ease-in-out 0.1s,
29+
max-height 0.3s ease-in-out 0.2s,
30+
margin 0.3s ease-in-out 0.2s;
1731
}
1832
1933
.toggle-icon {
2034
width: 1.2rem;
2135
height: 1.2rem;
2236
fill: ${(props) => props.theme.primaryColor};
23-
transition: 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
37+
transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
38+
}
39+
40+
.toggle-icon.expanded {
41+
transform: rotate(90deg);
2442
}
2543
2644
p {
2745
font-size: 0.9rem;
2846
margin: 0.5rem;
2947
color: ${(props) => props.theme.greyC1C1C1ToGreyB3B3B3};
30-
transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
3148
}
3249
3350
.toggle-btn {
@@ -36,17 +53,6 @@ const FeatureDetailsWrapper = styled.div`
3653
vertical-align: middle;
3754
}
3855
39-
.closed {
40-
opacity: 1;
41-
height: 0;
42-
transition: none;
43-
visibility: hidden;
44-
}
45-
46-
.open {
47-
visibility: visible;
48-
}
49-
5056
h5 {
5157
display: inline-block;
5258
vertical-align: middle;
@@ -65,26 +71,25 @@ const FeatureDetailsWrapper = styled.div`
6571
}
6672
`;
6773

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

77+
// Call onToggle when expand changes
78+
React.useEffect(() => {
79+
onToggle?.(expand);
80+
}, [expand, onToggle]);
81+
7182
const BetaTag = () => <span className="beta-tag">Coming Soon</span>;
7283

7384
return (
7485
<FeatureDetailsWrapper>
7586
<div onClick={() => setExpand(!expand)}>
76-
{description && (
87+
{(description || children) && (
7788
<div className="toggle-btn">
7889
{expand ? (
79-
<MdExpandMore
80-
className="toggle-icon"
81-
onClick={() => setExpand(!expand)}
82-
/>
90+
<MdExpandMore className="toggle-icon" />
8391
) : (
84-
<RiArrowRightSLine
85-
className="toggle-icon"
86-
onClick={() => setExpand(!expand)}
87-
/>
92+
<RiArrowRightSLine className="toggle-icon" />
8893
)}
8994
</div>
9095
)}
@@ -93,13 +98,18 @@ const FeatureDetails = ({ category, description, tier }) => {
9398
{tier === "Team-Beta" && <BetaTag />}
9499
</h5>
95100
<div className="details">
96-
<p className={`closed ${expand ? "open" : ""}`}
97-
dangerouslySetInnerHTML={{ __html: description }}>
98-
</p>
101+
{description && (
102+
<p className={expand ? "open" : ""} dangerouslySetInnerHTML={{ __html: description }} />
103+
)}
104+
{children && (
105+
<div className={expand ? "open" : ""}>
106+
{children}
107+
</div>
108+
)}
99109
</div>
100110
</div>
101111
</FeatureDetailsWrapper>
102112
);
103113
};
104114

105-
export default FeatureDetails;
115+
export default FeatureDetails;

src/components/PlanCard/planCard.style.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,17 @@ const PlanCardWrapper = styled.section`
219219
font-weight: 500;
220220
transition: 0.3s;
221221
background: ${(props) => props.theme.secondaryColor};
222+
223+
}
224+
.addon-chip {
225+
background-color: rgba(0, 179, 159, 0.15);
226+
color: ${(props) => props.theme.text.light};
227+
border: 1px solid;
228+
border-color: ${(props) => props.theme.secondaryColor};
229+
230+
}
231+
.addon-chip .MuiChip-icon {
232+
color: ${(props) => props.theme.secondaryColor};
222233
}
223234
`;
224235

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react";
2+
const AcademyIcon = ({ width = "32px", height = "32px", primaryFill, secondaryFill }) => {
3+
return (
4+
<svg
5+
fill={primaryFill}
6+
width={width}
7+
height={height}
8+
viewBox="0 0 22 22"
9+
xmlns="http://www.w3.org/2000/svg"
10+
data-name="Layer 1"
11+
>
12+
{/*middle-part*/}
13+
<path
14+
fill={secondaryFill}
15+
d="M3.8,7.5v9h-1.7c-.3,0-.6.3-.6.6v.9h19.5v-.9c0-.3-.3-.6-.6-.6h-1.7V7.5h-3v9h-3V7.5h-3v9h-3V7.5h-3Z"
16+
/>
17+
{/*bottom-part*/}
18+
<path
19+
fill={primaryFill}
20+
d="M21.4,18.8H1.1c-.6,0-1.1.5-1.1,1.1v.8c0,.2.2.4.4.4h21.8c.2,0,.4-.2.4-.4v-.8c0-.6-.5-1.1-1.1-1.1Z"
21+
/>
22+
{/*head-part*/}
23+
<path
24+
fill={primaryFill}
25+
d="M22.5,4.5v.8c0,.2-.2.4-.4.4h-1.1v.6c0,.3-.3.6-.6.6H2.1c-.3,0-.6-.3-.6-.6v-.6H.4c-.2,0-.4-.2-.4-.4v-.8c0-.2,0-.3.2-.3L11.1,0c0,0,.2,0,.3,0l10.9,4.1c.1,0,.2.2.2.3Z"
26+
/>
27+
</svg>
28+
);
29+
};
30+
export default AcademyIcon;

0 commit comments

Comments
 (0)