-
Notifications
You must be signed in to change notification settings - Fork 218
Fix: last column not visible in 2x2 tables on mobile and tablet views #6258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stage
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -692,6 +692,10 @@ | |
| margin: 0; | ||
| } | ||
|
|
||
| .table.preserve-columns .section-row-title { | ||
| grid-column: auto !important; | ||
| } | ||
|
|
||
| .table:not(.merch) .row .section-head-title, | ||
| .table:not(.merch) .row .section-row-title { | ||
| border-right: 1px solid var(--border-color); | ||
|
|
@@ -701,12 +705,25 @@ | |
| display: block; | ||
| } | ||
|
|
||
| .table.preserve-columns .col-heading.col-1, | ||
| .table.preserve-columns .row-highlight .col-highlight.col-1 { | ||
| display: flex !important; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
| } | ||
|
|
||
| .table .section-head .col:not(.section-head-title), | ||
| .table:not(.merch) .col-heading.col-1, | ||
| .table:not(.merch) .row-highlight .col-highlight.col-1:not(:only-child) { | ||
| display: none; | ||
| } | ||
|
|
||
| .table.preserve-columns .row-heading .col-heading:first-child { | ||
| border-top-left-radius: var(--border-radius); | ||
| } | ||
|
|
||
| .table.preserve-columns .row-heading .col-heading:last-child { | ||
| border-top-left-radius: 0; | ||
| } | ||
|
|
||
| .table:not(.merch) .row-highlight:has(> :only-child) { | ||
| grid-template-columns: repeat(auto-fit, 100%); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -477,6 +477,9 @@ function applyStylesBasedOnScreenSize(table, originTable) { | |||||||||
| const deviceBySize = defineDeviceByScreenSize(); | ||||||||||
|
|
||||||||||
| const setRowStyle = () => { | ||||||||||
| if (table.classList.contains('preserve-columns')) { | ||||||||||
| return; | ||||||||||
| } | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit;
Suggested change
|
||||||||||
| if (isMerch) return; | ||||||||||
| const sectionRow = Array.from(table.getElementsByClassName('section-row')); | ||||||||||
| if (sectionRow.length) { | ||||||||||
|
|
@@ -614,7 +617,10 @@ function applyStylesBasedOnScreenSize(table, originTable) { | |||||||||
| } | ||||||||||
|
|
||||||||||
| removeClones(); | ||||||||||
| if (deviceBySize === 'MOBILE' || (isMerch && deviceBySize === 'TABLET')) { | ||||||||||
| if ( | ||||||||||
| !table.classList.contains('preserve-columns') | ||||||||||
| && (deviceBySize === 'MOBILE' || (isMerch && deviceBySize === 'TABLET')) | ||||||||||
| ) { | ||||||||||
| mobileRenderer(); | ||||||||||
| } else { | ||||||||||
| table.querySelectorAll('.hide-mobile, .left-round, .right-round').forEach((col) => { col.classList.remove('hide-mobile', 'left-round', 'right-round'); }); | ||||||||||
|
|
@@ -670,6 +676,13 @@ export default function init(el) { | |||||||||
| expandSection = handleSection(sectionParams); | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| const firstRow = el.querySelector('.row-1'); | ||||||||||
| const columnCount = firstRow?.children.length || 0; | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||
|
|
||||||||||
| if (columnCount <= 2) { | ||||||||||
| el.classList.add('preserve-columns'); | ||||||||||
| } | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||
|
|
||||||||||
| handleHighlight(el); | ||||||||||
| handleStickyHeader(el); | ||||||||||
| if (isMerch) formatMerchTable(el); | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <div class="table"> | ||
| <div> | ||
| <div><p>Feature</p></div> | ||
| <div><p>Details</p></div> | ||
| </div> | ||
| <div> | ||
| <div><p>Row 2 label</p></div> | ||
| <div><p>Row 2 value</p></div> | ||
| </div> | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can selector be adjusted so we can avoid
!important?