You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2022/04/07 21:47:56 UTC

[superset] branch master updated: refactor: Removes the CSS files from the Horizon plugin (#19562)

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

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d511e4fbc4 refactor: Removes the CSS files from the Horizon plugin (#19562)
d511e4fbc4 is described below

commit d511e4fbc46137934bb0ca615eb80b061f6dba6e
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Thu Apr 7 18:47:41 2022 -0300

    refactor: Removes the CSS files from the Horizon plugin (#19562)
    
    * refactor: Removes the CSS files from the Horizon plugin
    
    * Removes the CSS file
    
    * Uses font-size from the theme
---
 .../legacy-plugin-chart-horizon/package.json       | 33 +++++------
 .../src/HorizonChart.css                           | 38 ------------
 .../src/HorizonChart.jsx                           | 68 +++++++++++++++-------
 3 files changed, 61 insertions(+), 78 deletions(-)

diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/package.json b/superset-frontend/plugins/legacy-plugin-chart-horizon/package.json
index d4d2c75606..e0c2344761 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/package.json
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/package.json
@@ -2,31 +2,25 @@
   "name": "@superset-ui/legacy-plugin-chart-horizon",
   "version": "0.18.25",
   "description": "Superset Legacy Chart - Horizon",
-  "sideEffects": [
-    "*.css"
-  ],
-  "main": "lib/index.js",
-  "module": "esm/index.js",
-  "files": [
-    "esm",
-    "lib"
-  ],
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/apache-superset/superset-ui.git"
-  },
   "keywords": [
     "superset"
   ],
-  "author": "Superset",
-  "license": "Apache-2.0",
+  "homepage": "https://github.com/apache-superset/superset-ui#readme",
   "bugs": {
     "url": "https://github.com/apache-superset/superset-ui/issues"
   },
-  "homepage": "https://github.com/apache-superset/superset-ui#readme",
-  "publishConfig": {
-    "access": "public"
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/apache-superset/superset-ui.git"
   },
+  "license": "Apache-2.0",
+  "author": "Superset",
+  "main": "lib/index.js",
+  "module": "esm/index.js",
+  "files": [
+    "esm",
+    "lib"
+  ],
   "dependencies": {
     "d3-array": "^2.0.3",
     "d3-scale": "^3.0.1",
@@ -36,5 +30,8 @@
     "@superset-ui/chart-controls": "*",
     "@superset-ui/core": "*",
     "react": "^15 || ^16"
+  },
+  "publishConfig": {
+    "access": "public"
   }
 }
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.css b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.css
deleted file mode 100644
index bbdf6d6889..0000000000
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.css
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-.superset-legacy-chart-horizon {
-  overflow: auto;
-  position: relative;
-}
-
-.superset-legacy-chart-horizon .horizon-row {
-  border-bottom: solid 1px #ddd;
-  border-top: 0px;
-  padding: 0px;
-  margin: 0px;
-}
-
-.superset-legacy-chart-horizon .horizon-row span.title {
-  position: absolute;
-  color: #333;
-  font-size: 0.8em;
-  margin: 0;
-  text-shadow: 1px 1px rgba(255, 255, 255, 0.75);
-}
diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx
index b71227b6cd..e4a32c8de3 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/src/HorizonChart.jsx
@@ -20,9 +20,8 @@
 import React from 'react';
 import PropTypes from 'prop-types';
 import { extent as d3Extent } from 'd3-array';
-import { ensureIsArray } from '@superset-ui/core';
+import { ensureIsArray, styled } from '@superset-ui/core';
 import HorizonRow, { DEFAULT_COLORS } from './HorizonRow';
-import './HorizonChart.css';
 
 const propTypes = {
   className: PropTypes.string,
@@ -58,6 +57,29 @@ const defaultProps = {
   offsetX: 0,
 };
 
+const StyledDiv = styled.div`
+  ${({ theme }) => `
+    .superset-legacy-chart-horizon {
+      overflow: auto;
+      position: relative;
+    }
+
+    .superset-legacy-chart-horizon .horizon-row {
+      border-bottom: solid 1px ${theme.colors.grayscale.light2};
+      border-top: 0;
+      padding: 0;
+      margin: 0;
+    }
+
+    .superset-legacy-chart-horizon .horizon-row span.title {
+      position: absolute;
+      color: ${theme.colors.grayscale.dark1};
+      font-size: ${theme.typography.sizes.s}px;
+      margin: 0;
+    }
+  `}
+`;
+
 class HorizonChart extends React.PureComponent {
   render() {
     const {
@@ -83,26 +105,28 @@ class HorizonChart extends React.PureComponent {
     }
 
     return (
-      <div
-        className={`superset-legacy-chart-horizon ${className}`}
-        style={{ height }}
-      >
-        {data.map(row => (
-          <HorizonRow
-            key={row.key}
-            width={width}
-            height={seriesHeight}
-            title={ensureIsArray(row.key).join(', ')}
-            data={row.values}
-            bands={bands}
-            colors={colors}
-            colorScale={colorScale}
-            mode={mode}
-            offsetX={offsetX}
-            yDomain={yDomain}
-          />
-        ))}
-      </div>
+      <StyledDiv>
+        <div
+          className={`superset-legacy-chart-horizon ${className}`}
+          style={{ height }}
+        >
+          {data.map(row => (
+            <HorizonRow
+              key={row.key}
+              width={width}
+              height={seriesHeight}
+              title={ensureIsArray(row.key).join(', ')}
+              data={row.values}
+              bands={bands}
+              colors={colors}
+              colorScale={colorScale}
+              mode={mode}
+              offsetX={offsetX}
+              yDomain={yDomain}
+            />
+          ))}
+        </div>
+      </StyledDiv>
     );
   }
 }