Skip to content

Commit e2dba0a

Browse files
authored
Merge pull request #6736 from layer5io/copilot/fix-0b9af2c9-5b96-4c93-a55c-20b11a83096f
Fix: Position add-on features last in PlanCard with horizontal separator line
2 parents 6d126f0 + ab79ed5 commit e2dba0a

4 files changed

Lines changed: 43 additions & 11 deletions

File tree

src/components/PlanCard/index.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,28 @@ const PlanCard = ({ planData , isYearly }) => {
9494

9595
<div className="pricing-features">
9696
{x.summary &&
97-
x.summary.map((t) => (
98-
<div className="feature" key={t.id}>
99-
<FeatureDetails
100-
category={t.category}
101-
description={t.description}
102-
tier={t.tier}
103-
/>
104-
</div>
105-
))}
97+
x.summary.map((t, index) => {
98+
// Check if this is the first add-on feature
99+
const isFirstAddOn = t.categoryOrder === "add-on" &&
100+
(index === 0 || x.summary[index - 1].categoryOrder !== "add-on");
101+
102+
return (
103+
<div key={t.id}>
104+
{isFirstAddOn && (
105+
<div className="add-on-separator">
106+
<hr className="add-on-line" />
107+
</div>
108+
)}
109+
<div className="feature">
110+
<FeatureDetails
111+
category={t.category}
112+
description={t.description}
113+
tier={t.tier}
114+
/>
115+
</div>
116+
</div>
117+
);
118+
})}
106119
</div>
107120

108121
</div>

src/components/PlanCard/planCard.style.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ const PlanCardWrapper = styled.section`
138138
.pricing-features {
139139
margin-top: 2rem;
140140
line-height: 1rem;
141+
.add-on-separator {
142+
margin: 1.5rem 0 1rem 0;
143+
.add-on-line {
144+
border: none;
145+
border-top: 1px solid ${(props) => props.theme.greyDCDCDCToGrey3B3B3B};
146+
opacity: 0.5;
147+
margin: 0;
148+
}
149+
}
141150
.feature {
142151
margin: 0rem 0rem;
143152
line-height: 1rem;

src/sections/Pricing/comparison.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ const Comparison = () => {
202202
<tbody>
203203
<tr>
204204
<th className="price-blank"></th>
205-
<th className="price-blank"></th>
205+
<th className="price-blank"></th>
206206
<th className="price-table-popular">Most popular</th>
207207
<th className="price-blank"></th>
208208
<th className="price-blank"></th>

src/sections/Pricing/generatePlans.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,17 @@ function generatePlans(data) {
7272

7373
return mappedItem;
7474
})
75-
.sort((a, b) => a.categoryOrder - b.categoryOrder || a.functionOrder - b.functionOrder);
75+
.sort((a, b) => {
76+
// Handle "add-on" category order - should come last
77+
if (a.categoryOrder === "add-on" && b.categoryOrder !== "add-on") return 1;
78+
if (a.categoryOrder !== "add-on" && b.categoryOrder === "add-on") return -1;
79+
if (a.categoryOrder === "add-on" && b.categoryOrder === "add-on") {
80+
return a.functionOrder - b.functionOrder;
81+
}
82+
83+
// Normal numeric sorting for non add-on categories
84+
return a.categoryOrder - b.categoryOrder || a.functionOrder - b.functionOrder;
85+
});
7686
return {
7787
...tierInfo,
7888
summary: summary.length > 0 ? summary : [],

0 commit comments

Comments
 (0)