You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/09/15 05:08:08 UTC

[superset] 02/02: linting

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch revising-table-bar-chart-css
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 9d71ae10ab7466bb1a3cf6e9d3405f1d48f668ea
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Wed Sep 14 23:07:49 2022 -0600

    linting
---
 .../plugins/plugin-chart-table/src/TableChart.tsx  | 53 ++++++++++------------
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
index 0cffa1fdbc..8bbf893543 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
@@ -142,9 +142,7 @@ function cellBackground({
   colorPositiveNegative: boolean;
 }) {
   const r = colorPositiveNegative && value < 0 ? 150 : 0;
-  return (
-    `rgba(${r},0,0,0.2)`
-  );
+  return `rgba(${r},0,0,0.2)`;
 }
 
 function SortIcon<D extends object>({ column }: { column: ColumnInstance<D> }) {
@@ -440,29 +438,23 @@ export default function TableChart<D extends DataRecord = DataRecord>(
             height: 100%;
             display: block;
             top: 0;
-            ${
-              valueRange && `
-                width: ${
-                  cellWidth({
-                      value: value as number,
-                      valueRange,
-                      alignPositiveNegative,
-                    }) + '%'};
-                left: ${
-                  cellOffset({
-                      value: value as number,
-                      valueRange,
-                      alignPositiveNegative,
-                    }) + '%'
-                  };
-                background-color: ${
-                  cellBackground({
-                      value: value as number,
-                      colorPositiveNegative,
-                    })
-                  };
-              `
-            }
+            ${valueRange &&
+            `
+                width: ${`${cellWidth({
+                  value: value as number,
+                  valueRange,
+                  alignPositiveNegative,
+                })}%`};
+                left: ${`${cellOffset({
+                  value: value as number,
+                  valueRange,
+                  alignPositiveNegative,
+                })}%`};
+                background-color: ${cellBackground({
+                  value: value as number,
+                  colorPositiveNegative,
+                })};
+              `}
           `;
 
           const cellProps = {
@@ -509,12 +501,13 @@ export default function TableChart<D extends DataRecord = DataRecord>(
                 text
               )}
               {valueRange && (
-                <div className={
-                  cx(
+                <div
+                  className={cx(
                     'cell-bar',
                     value && value < 0 ? 'negative' : 'positive',
-                  )
-                }  css={cellBarStyles} />
+                  )}
+                  css={cellBarStyles}
+                />
               )}
             </StyledCell>
           );