You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/27 12:30:36 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #19866: chore: fix explore pills

michael-s-molina commented on code in PR #19866:
URL: https://github.com/apache/superset/pull/19866#discussion_r859714078


##########
superset-frontend/src/components/AlteredSliceTag/index.jsx:
##########
@@ -183,9 +193,7 @@ export default class AlteredSliceTag extends React.Component {
   renderTriggerNode() {
     return (
       <Tooltip id="difference-tooltip" title={t('Click to see difference')}>
-        <span className="label label-warning" style={{ fontSize: '12px' }}>
-          {t('Altered')}
-        </span>
+        <StyledLabel className="label">{t('Altered')}</StyledLabel>

Review Comment:
   Do we need the `label` className here? If yes, is the CSS coming from a less file? If yes, can we remove it and add the properties to the styled component?



##########
superset-frontend/src/explore/components/RowCountLabel/index.tsx:
##########
@@ -17,36 +17,43 @@
  * under the License.
  */
 import React from 'react';
-import { getNumberFormatter, t } from '@superset-ui/core';
+import { getNumberFormatter, t, tn } from '@superset-ui/core';
 
 import Label from 'src/components/Label';
 import { Tooltip } from 'src/components/Tooltip';
 
 type RowCountLabelProps = {
-  rowcount: number;
+  rowcount?: number;
   limit?: number;
-  suffix?: string;
   loading?: boolean;
 };
 
 export default function RowCountLabel(props: RowCountLabelProps) {
-  const { rowcount = 0, limit, suffix = t('rows'), loading } = props;
+  const { rowcount = 0, limit, loading } = props;
   const limitReached = rowcount === limit;
   const type =
     limitReached || (rowcount === 0 && !loading) ? 'danger' : 'default';
   const formattedRowCount = getNumberFormatter()(rowcount);
-  const tooltip = (
-    <span>
-      {limitReached && <div>{t('Limit reached')}</div>}
-      {loading ? 'Loading' : rowcount}
-    </span>
+  const label = (
+    <Label type={type} data-test="row-count-label">
+      {loading
+        ? 'Loading...'

Review Comment:
   ```suggestion
           ? t('Loading...')
   ```



##########
superset-frontend/src/components/AlteredSliceTag/index.jsx:
##########
@@ -32,6 +32,16 @@ const propTypes = {
   currentFormData: PropTypes.object.isRequired,
 };
 
+const StyledLabel = styled.span`
+  ${({ theme }) => `
+    font-size: ${theme.typography.sizes.s}px;
+    background-color: ${theme.colors.alert.base};
+
+    &: hover {
+      background-color: ${theme.colors.alert.dark1};
+    };`}

Review Comment:
   ```suggestion
     ${({ theme }) => `
       font-size: ${theme.typography.sizes.s}px;
       background-color: ${theme.colors.alert.base};
   
       &: hover {
         background-color: ${theme.colors.alert.dark1};
       }
     `}
   ```



##########
superset-frontend/src/explore/components/RowCountLabel/index.tsx:
##########
@@ -17,36 +17,43 @@
  * under the License.
  */
 import React from 'react';
-import { getNumberFormatter, t } from '@superset-ui/core';
+import { getNumberFormatter, t, tn } from '@superset-ui/core';
 
 import Label from 'src/components/Label';
 import { Tooltip } from 'src/components/Tooltip';
 
 type RowCountLabelProps = {
-  rowcount: number;
+  rowcount?: number;
   limit?: number;
-  suffix?: string;
   loading?: boolean;
 };
 
 export default function RowCountLabel(props: RowCountLabelProps) {
-  const { rowcount = 0, limit, suffix = t('rows'), loading } = props;
+  const { rowcount = 0, limit, loading } = props;
   const limitReached = rowcount === limit;
   const type =
     limitReached || (rowcount === 0 && !loading) ? 'danger' : 'default';
   const formattedRowCount = getNumberFormatter()(rowcount);
-  const tooltip = (
-    <span>
-      {limitReached && <div>{t('Limit reached')}</div>}
-      {loading ? 'Loading' : rowcount}
-    </span>
+  const label = (
+    <Label type={type} data-test="row-count-label">
+      {loading
+        ? 'Loading...'
+        : tn('%s row', '%s rows', rowcount, formattedRowCount)}
+    </Label>
   );
-  return (
-    <Tooltip id="tt-rowcount-tooltip" title={tooltip}>
-      <Label type={type} data-test="row-count-label">
-        {loading ? 'Loading...' : `${formattedRowCount} ${suffix}`}
-      </Label>
+  return limitReached ? (
+    <Tooltip
+      id="tt-rowcount-tooltip"
+      title={
+        <span>

Review Comment:
   Do we need the `div` or only the `span` is sufficient?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org