From 7b9d9b960ba70338b5503ec1795b92349de056c9 Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Fri, 7 Feb 2025 19:05:32 -0500 Subject: [PATCH 1/5] Wrap content in div --- src/components/ListTable.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/ListTable.js b/src/components/ListTable.js index e37f9a58a..1722d7ba1 100644 --- a/src/components/ListTable.js +++ b/src/components/ListTable.js @@ -78,7 +78,9 @@ const bodyCellStyle = css` flex-direction: column; align-items: flex-start; } +`; +const bodyCellContentStyle = css` *, p, a { @@ -86,14 +88,14 @@ const bodyCellStyle = css` } // Target any nested components (paragraphs, admonitions, tables) and any paragraphs within those nested components - & > div > *, - & > div > div p { + & > *, + & > div p { margin: 0 0 12px; } // Prevent extra margin below last element (such as when multiple paragraphs are present) - & > div > div *:last-child, - & > div > *:last-child { + & > div *:last-child, + & > *:last-child { margin-bottom: 0; } `; @@ -308,7 +310,7 @@ const ListTable = ({ nodeData: { children, options }, ...rest }) => { {headerGroup.headers.map((header) => { return ( - {flexRender(header.column.columnDef.header, header.getContext())} +
{flexRender(header.column.columnDef.header, header.getContext())}
); })} @@ -323,7 +325,7 @@ const ListTable = ({ nodeData: { children, options }, ...rest }) => { const role = isStub ? 'rowheader' : null; return ( - {cell.renderValue()} +
{cell.renderValue()}
); })} From 0d96a42d56e14228fa559a5455181f4d95197c17 Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Mon, 10 Feb 2025 18:23:32 -0500 Subject: [PATCH 2/5] Update snapshot --- .../unit/__snapshots__/ListTable.test.js.snap | 576 +++++++++++------- 1 file changed, 350 insertions(+), 226 deletions(-) diff --git a/tests/unit/__snapshots__/ListTable.test.js.snap b/tests/unit/__snapshots__/ListTable.test.js.snap index 361037d02..61dc39366 100644 --- a/tests/unit/__snapshots__/ListTable.test.js.snap +++ b/tests/unit/__snapshots__/ListTable.test.js.snap @@ -76,22 +76,6 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` align-items: flex-start; } -.emotion-3 *, -.emotion-3 p, -.emotion-3 a { - line-height: 20px; -} - -.emotion-3>div>*, -.emotion-3>div>div p { - margin: 0 0 12px; -} - -.emotion-3>div>div *:last-child, -.emotion-3>div>*:last-child { - margin-bottom: 0; -} - .emotion-4 { display: -webkit-box; display: -webkit-flex; @@ -115,7 +99,23 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` text-align: left; } -.emotion-5 { +.emotion-5 *, +.emotion-5 p, +.emotion-5 a { + line-height: 20px; +} + +.emotion-5>*, +.emotion-5>div p { + margin: 0 0 12px; +} + +.emotion-5>div *:last-child, +.emotion-5>*:last-child { + margin-bottom: 0; +} + +.emotion-6 { margin: unset; font-family: 'Euclid Circular A','Helvetica Neue',Helvetica,Arial,sans-serif; color: #001E2B; @@ -127,12 +127,12 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` color: var(--font-color-primary); } -.emotion-5 strong, -.emotion-5 b { +.emotion-6 strong, +.emotion-6 b { font-weight: 700; } -.emotion-6 { +.emotion-7 { padding: 0 8px; overflow: hidden; padding: 10px 8px!important; @@ -145,25 +145,25 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` align-content: flex-start; } -.emotion-6:focus-visible { +.emotion-7:focus-visible { box-shadow: inset; } -.emotion-6:last-child { +.emotion-7:last-child { padding-right: 24px; } -.emotion-6 * { +.emotion-7 * { font-size: 13px!important; line-height: inherit; } -.emotion-6>div { +.emotion-7>div { height: unset; min-height: unset; } -.emotion-6>div { +.emotion-7>div { min-height: unset; max-height: unset; -webkit-flex-direction: column; @@ -175,22 +175,6 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` align-items: flex-start; } -.emotion-6 *, -.emotion-6 p, -.emotion-6 a { - line-height: 20px; -} - -.emotion-6>div>*, -.emotion-6>div>div p { - margin: 0 0 12px; -} - -.emotion-6>div>div *:last-child, -.emotion-6>div>*:last-child { - margin-bottom: 0; -} -
-

- notebook -

+

+ notebook +

+
-

- 50 -

+

+ 50 +

+
-

- 8.5x11,in -

+

+ 8.5x11,in +

+
-

- A -

+

+ A +

+
-

- college-ruled,perforated -

+

+ college-ruled,perforated +

+
-

- 8 -

+

+ 8 +

+
@@ -494,22 +502,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` align-items: flex-start; } -.emotion-16 *, -.emotion-16 p, -.emotion-16 a { - line-height: 20px; -} - -.emotion-16>div>*, -.emotion-16>div>div p { - margin: 0 0 12px; -} - -.emotion-16>div>div *:last-child, -.emotion-16>div>*:last-child { - margin-bottom: 0; -} - .dark-theme .emotion-16 { background-color: #112733; border-right: 3px solid #3D4F58; @@ -538,7 +530,23 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` text-align: left; } -.emotion-18 { +.emotion-18 *, +.emotion-18 p, +.emotion-18 a { + line-height: 20px; +} + +.emotion-18>*, +.emotion-18>div p { + margin: 0 0 12px; +} + +.emotion-18>div *:last-child, +.emotion-18>*:last-child { + margin-bottom: 0; +} + +.emotion-19 { margin: unset; font-family: 'Euclid Circular A','Helvetica Neue',Helvetica,Arial,sans-serif; color: #001E2B; @@ -550,12 +558,12 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` color: var(--font-color-primary); } -.emotion-18 strong, -.emotion-18 b { +.emotion-19 strong, +.emotion-19 b { font-weight: 700; } -.emotion-19 { +.emotion-20 { padding: 0 8px; overflow: hidden; padding: 10px 8px!important; @@ -568,25 +576,25 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` align-content: flex-start; } -.emotion-19:focus-visible { +.emotion-20:focus-visible { box-shadow: inset; } -.emotion-19:last-child { +.emotion-20:last-child { padding-right: 24px; } -.emotion-19 * { +.emotion-20 * { font-size: 13px!important; line-height: inherit; } -.emotion-19>div { +.emotion-20>div { height: unset; min-height: unset; } -.emotion-19>div { +.emotion-20>div { min-height: unset; max-height: unset; -webkit-flex-direction: column; @@ -598,22 +606,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` align-items: flex-start; } -.emotion-19 *, -.emotion-19 p, -.emotion-19 a { - line-height: 20px; -} - -.emotion-19>div>*, -.emotion-19>div>div p { - margin: 0 0 12px; -} - -.emotion-19>div>div *:last-child, -.emotion-19>div>*:last-child { - margin-bottom: 0; -} -
- name +
+ name +
- quantity +
+ quantity +
- size +
+ size +
- status +
+ status +
- tags +
+ tags +
- rating +
+ rating +
@@ -704,81 +708,105 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` class="emotion-17" data-state="entered" > -

- journal -

+

+ journal +

+
-

- 25 -

+

+ 25 +

+
-

- 14x21,cm -

+

+ 14x21,cm +

+
-

- A -

+

+ A +

+
-

- brown, lined -

+

+ brown, lined +

+
-

- 9 -

+

+ 9 +

+
@@ -796,81 +824,105 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` class="emotion-17" data-state="entered" > -

- notebook -

+

+ notebook +

+
-

- 50 -

+

+ 50 +

+
-

- 8.5x11,in -

+

+ 8.5x11,in +

+
-

- A -

+

+ A +

+
-

- college-ruled,perforated -

+

+ college-ruled,perforated +

+
-

- 8 -

+

+ 8 +

+
@@ -888,81 +940,105 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` class="emotion-17" data-state="entered" > -

- paper -

+

+ paper +

+
-

- 100 -

+

+ 100 +

+
-

- 8.5x11,in -

+

+ 8.5x11,in +

+
-

- D -

+

+ D +

+
-

- watercolor -

+

+ watercolor +

+
-

- 10 -

+

+ 10 +

+
@@ -980,81 +1056,105 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` class="emotion-17" data-state="entered" > -

- planner -

+

+ planner +

+
-

- 75 -

+

+ 75 +

+
-

- 22.85x30,cm -

+

+ 22.85x30,cm +

+
-

- D -

+

+ D +

+
-

- 2019 -

+

+ 2019 +

+
-

- 10 -

+

+ 10 +

+
@@ -1072,81 +1172,105 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` class="emotion-17" data-state="entered" > -

- postcard -

+

+ postcard +

+
-

- 45 -

+

+ 45 +

+
-

- 10x,cm -

+

+ 10x,cm +

+
-

- D -

+

+ D +

+
-

- double-sided,white -

+

+ double-sided,white +

+
-

- 2 -

+

+ 2 +

+
From 810437e00f86f2bae5d5ce7abad06be318e48193 Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:27:31 -0500 Subject: [PATCH 3/5] Fix styling --- src/components/ListTable.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/ListTable.js b/src/components/ListTable.js index 1722d7ba1..f6cc92153 100644 --- a/src/components/ListTable.js +++ b/src/components/ListTable.js @@ -57,7 +57,6 @@ const baseCellStyle = css` * { // Wrap in selector to ensure it cascades down to every element font-size: ${theme.fontSize.small} !important; - line-height: inherit; } // Ensure each cell is no higher than the highest content in row @@ -90,13 +89,13 @@ const bodyCellContentStyle = css` // Target any nested components (paragraphs, admonitions, tables) and any paragraphs within those nested components & > *, & > div p { - margin: 0 0 12px; + margin: 0 0 12px !important; } // Prevent extra margin below last element (such as when multiple paragraphs are present) & > div *:last-child, & > *:last-child { - margin-bottom: 0; + margin-bottom: 0 !important; } `; From 295c5880250242041bcd6da7aa8307919ee8973c Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:30:28 -0500 Subject: [PATCH 4/5] Snap --- tests/unit/__snapshots__/ListTable.test.js.snap | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/unit/__snapshots__/ListTable.test.js.snap b/tests/unit/__snapshots__/ListTable.test.js.snap index 61dc39366..b6908d761 100644 --- a/tests/unit/__snapshots__/ListTable.test.js.snap +++ b/tests/unit/__snapshots__/ListTable.test.js.snap @@ -56,7 +56,6 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` .emotion-3 * { font-size: 13px!important; - line-height: inherit; } .emotion-3>div { @@ -107,12 +106,12 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` .emotion-5>*, .emotion-5>div p { - margin: 0 0 12px; + margin: 0 0 12px!important; } .emotion-5>div *:last-child, .emotion-5>*:last-child { - margin-bottom: 0; + margin-bottom: 0!important; } .emotion-6 { @@ -155,7 +154,6 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = ` .emotion-7 * { font-size: 13px!important; - line-height: inherit; } .emotion-7>div { @@ -383,7 +381,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` .emotion-3 * { font-size: 13px!important; - line-height: inherit; } .emotion-3>div { @@ -435,7 +432,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` .emotion-5 * { font-size: 13px!important; - line-height: inherit; } .emotion-5>div { @@ -482,7 +478,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` .emotion-16 * { font-size: 13px!important; - line-height: inherit; } .emotion-16>div { @@ -538,12 +533,12 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` .emotion-18>*, .emotion-18>div p { - margin: 0 0 12px; + margin: 0 0 12px!important; } .emotion-18>div *:last-child, .emotion-18>*:last-child { - margin-bottom: 0; + margin-bottom: 0!important; } .emotion-19 { @@ -586,7 +581,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = ` .emotion-20 * { font-size: 13px!important; - line-height: inherit; } .emotion-20>div { From d4b8b2c785cecf14074c07f664496246ba78217f Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:14:28 -0500 Subject: [PATCH 5/5] Adds comment --- src/components/ListTable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/ListTable.js b/src/components/ListTable.js index f6cc92153..4935d3923 100644 --- a/src/components/ListTable.js +++ b/src/components/ListTable.js @@ -309,6 +309,7 @@ const ListTable = ({ nodeData: { children, options }, ...rest }) => { {headerGroup.headers.map((header) => { return ( + {/* Wraps cell content inside of a div so that all of its content are together when laid out. */}
{flexRender(header.column.columnDef.header, header.getContext())}
); @@ -324,6 +325,7 @@ const ListTable = ({ nodeData: { children, options }, ...rest }) => { const role = isStub ? 'rowheader' : null; return ( + {/* Wraps cell content inside of a div so that all of its content are together when laid out. */}
{cell.renderValue()}
);