Skip to content

Commit

Permalink
feat: add certified icon to columoption (apache#1330)
Browse files Browse the repository at this point in the history
* add certified icon to columoption

* fix import order
  • Loading branch information
pkdotson authored and zhaoyongjie committed Nov 17, 2021
1 parent 43e4d01 commit 0f2b659
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
* under the License.
*/
import React from 'react';
import { styled } from '@superset-ui/core';
import { Tooltip } from './Tooltip';
import { ColumnTypeLabel } from './ColumnTypeLabel';
import InfoTooltipWithTrigger from './InfoTooltipWithTrigger';
import CertifiedIconWithTooltip from './CertifiedIconWithTooltip';
import { ColumnMeta } from '../types';

export type ColumnOptionProps = {
Expand All @@ -29,6 +31,12 @@ export type ColumnOptionProps = {
labelRef?: React.RefObject<any>;
};

const StyleOverrides = styled.span`
svg {
margin-right: ${({ theme }) => theme.gridUnit}px;
}
`;

export function ColumnOption({
column,
labelRef,
Expand All @@ -40,8 +48,15 @@ export function ColumnOption({
const type = hasExpression ? 'expression' : type_generic;

return (
<span>
<StyleOverrides>
{showType && type !== undefined && <ColumnTypeLabel type={type} />}
{column.is_certified && (
<CertifiedIconWithTooltip
metricName={column.metric_name}
certifiedBy={column.certified_by}
details={column.certification_details}
/>
)}
{showTooltip ? (
<Tooltip
id="metric-name-tooltip"
Expand Down Expand Up @@ -76,7 +91,7 @@ export function ColumnOption({
placement="top"
/>
)}
</span>
</StyleOverrides>
);
}

Expand Down

0 comments on commit 0f2b659

Please sign in to comment.