Skip to content

Commit e8313cb

Browse files
authored
fix(pricing-table): 11875 ux and qa findings recommendations (#12569)
### Related Ticket(s) https://jsw.ibm.com/browse/ADCMS-11875 ### Description Addressing last round of QA and UX findings in the comments: https://jsw.ibm.com/browse/ADCMS-11676?focusedId=29836670&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-29836670 https://jsw.ibm.com/browse/ADCMS-11676?focusedId=29862732&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-29862732 https://jsw.ibm.com/browse/ADCMS-11875?focusedId=29961245&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-29961245 ### Changelog - packages/styles/scss/components/pricing-table/_pricing-table.scss - new styles - packages/web-components/src/components/pricing-table/pricing-table.ts - new logic to select last highlighted cell in the last row
1 parent 199e45e commit e8313cb

2 files changed

Lines changed: 43 additions & 8 deletions

File tree

packages/styles/scss/components/pricing-table/_pricing-table.scss

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
overflow-y: hidden;
4141

42+
padding-block-end: 15px;
43+
4244
.#{$c4d-prefix}-pricing-table-sentinel {
4345
position: relative;
4446
display: block;
@@ -131,6 +133,19 @@
131133
}
132134
}
133135

136+
/* stylelint-disable-next-line selector-type-no-unknown */
137+
:host(c4d-pricing-table-group) tr[part~='row--group-title'] {
138+
box-shadow: 0 -3px 0 #e8daff;
139+
}
140+
141+
/* stylelint-disable-next-line selector-type-no-unknown */
142+
:host(c4d-pricing-table-header-cell) div[part~='heading-container'] {
143+
display: flex;
144+
flex-direction: column;
145+
justify-content: space-between;
146+
block-size: 100%;
147+
}
148+
134149
:host(#{$c4d-prefix}-pricing-table-group) tr {
135150
border: none;
136151
border-radius: 4px;
@@ -383,8 +398,11 @@
383398
}
384399

385400
:host([last-row]) {
386-
::slotted(.highlighted) {
401+
::slotted(.last-row-highlight) {
402+
position: relative;
403+
z-index: 0;
387404
border-radius: 0 0 10px 10px;
405+
margin-block-end: -10px;
388406
}
389407
}
390408
}

packages/web-components/src/components/pricing-table/pricing-table.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,28 @@ class C4DPricingTable extends HostListenerMixin(
169169
this._getHeaderElements();
170170
};
171171

172+
protected _setLastRowHighlight(): void {
173+
const rows = this.querySelectorAll(`${c4dPrefix}-pricing-table-row`);
174+
175+
rows.forEach((row, i) => {
176+
const isLastRow = i === rows.length - 1;
177+
row.toggleAttribute('last-row', isLastRow);
178+
179+
row.querySelectorAll('.last-row-highlight').forEach((cell) => {
180+
cell.classList.remove('last-row-highlight');
181+
});
182+
183+
if (isLastRow) {
184+
const highlightedCells = row.querySelectorAll(
185+
`${c4dPrefix}-pricing-table-cell.highlighted, ${c4dPrefix}-pricing-table-header-cell.highlighted`
186+
);
187+
highlightedCells.forEach((cell) => {
188+
cell.classList.add('last-row-highlight');
189+
});
190+
}
191+
});
192+
}
193+
172194
updated(): void {
173195
const { highlightColumn } = this;
174196

@@ -187,6 +209,8 @@ class C4DPricingTable extends HostListenerMixin(
187209
`)
188210
);
189211
}
212+
213+
this._setLastRowHighlight();
190214
}
191215

192216
connectedCallback() {
@@ -207,13 +231,6 @@ class C4DPricingTable extends HostListenerMixin(
207231
renderInner() {
208232
const { sentinelClass } = this.constructor as typeof C4DPricingTable;
209233

210-
//a selector for the last slotted highlighted row item becomes too complex. It's easier to just JS a 'last-row' class into it.
211-
const rows = this.querySelectorAll(`${c4dPrefix}-pricing-table-row`);
212-
213-
rows.forEach((row, i) => {
214-
row.toggleAttribute('last-row', i === rows.length - 1);
215-
});
216-
217234
this.setAPIPricingTableWidth();
218235

219236
return html`

0 commit comments

Comments
 (0)