kgabryje commented on code in PR #24154:
URL: https://github.com/apache/superset/pull/24154#discussion_r1297347780


##########
superset-frontend/src/explore/components/controls/ContourControl/ContourOption.tsx:
##########
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with work for additional information
+ * regarding copyright ownership.  The ASF licenses file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use 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.
+ */
+
+import React from 'react';
+import { styled } from '@superset-ui/core';
+import { ContourOptionProps } from './types';
+import ContourPopoverTrigger from './ContourPopoverTrigger';
+import OptionWrapper from '../DndColumnSelectControl/OptionWrapper';
+
+const StyledOptionWrapper = styled(OptionWrapper)`
+  max-width: 100%;
+  min-width: 100%;
+`;
+
+const StyledListItem = styled.li`
+  display: flex;
+  align-items: center;
+`;
+
+const ColorPatch = styled.div<{ formattedColor: string }>`
+  background-color: ${({ formattedColor }) => formattedColor};
+  height: 5px;
+  width: 5px;
+  margin: 0 5px;
+`;
+
+const ContourOption = ({
+  contour,
+  index,
+  saveContour,
+  onClose,
+  onShift,
+}: ContourOptionProps) => {
+  const { lowerThreshold, upperThreshold, color, strokeWidth } = contour;
+
+  const isIsoband = upperThreshold;
+
+  const formattedColor = color
+    ? `rgba(${color.r}, ${color.g}, ${color.b}, 1)`
+    : 'undefined';
+
+  const formatIsoline = (threshold: number, width: any) =>
+    `Threshold: ${threshold}, color: ${formattedColor}, stroke width: 
${width}`;
+
+  const formatIsoband = (threshold: number[]) =>
+    `Threshold: [${threshold[0]}, ${threshold[1]}], color: ${formattedColor}`;
+
+  const displayString = isIsoband
+    ? formatIsoband([lowerThreshold || -1, upperThreshold])
+    : formatIsoline(lowerThreshold || -1, strokeWidth);
+
+  const overlay = (
+    <div className="contour-tooltip-overlay">
+      <StyledListItem>
+        Threshold:{' '}
+        {isIsoband
+          ? `[${lowerThreshold}, ${upperThreshold}]`
+          : `${lowerThreshold}`}
+      </StyledListItem>
+      <StyledListItem>
+        Color: <ColorPatch formattedColor={formattedColor} /> {formattedColor}
+      </StyledListItem>
+      {!isIsoband && (
+        <StyledListItem>Stroke Width: {strokeWidth}</StyledListItem>
+      )}
+    </div>
+  );
+
+  return (
+    <ContourPopoverTrigger saveContour={saveContour} value={contour}>
+      <StyledOptionWrapper
+        key={index}

Review Comment:
   Is the key required here?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to