chore: Moves WarningIconWithTooltip to own folder (#14123)

This commit is contained in:
Michael S. Molina 2021-04-22 16:50:11 -04:00 committed by GitHub
parent 86233d1676
commit 3e23c103dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 23 deletions

View File

@ -16,27 +16,29 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
@import '../../stylesheets/less/variables.less'; import React from 'react';
import WarningIconWithTooltip, { WarningIconWithTooltipProps } from '.';
.TableSelector .fa-refresh { export default {
padding-left: 9px; title: 'WarningIconWithTooltip',
} component: WarningIconWithTooltip,
};
.TableSelector .section { export const InteractiveWarningIcon = (args: WarningIconWithTooltipProps) => (
padding-bottom: 5px; <div css={{ margin: 40 }}>
display: flex; <WarningIconWithTooltip {...args} />
flex-direction: row; </div>
} );
.TableSelector .select { InteractiveWarningIcon.args = {
flex-grow: 1; warningMarkdown: 'Markdown example',
} size: 20,
};
.TableSelector .divider { InteractiveWarningIcon.story = {
border-bottom: 1px solid @gray-bg; parameters: {
margin: 15px 0; knobs: {
} disable: true,
},
.TableLabel { },
white-space: nowrap; };
}

View File

@ -17,11 +17,11 @@
* under the License. * under the License.
*/ */
import React from 'react'; import React from 'react';
import { supersetTheme, SafeMarkdown } from '@superset-ui/core'; import { useTheme, SafeMarkdown } from '@superset-ui/core';
import Icon from 'src/components/Icon'; import Icon from 'src/components/Icon';
import { Tooltip } from 'src/components/Tooltip'; import { Tooltip } from 'src/components/Tooltip';
interface WarningIconWithTooltipProps { export interface WarningIconWithTooltipProps {
warningMarkdown: string; warningMarkdown: string;
size?: number; size?: number;
} }
@ -30,13 +30,14 @@ function WarningIconWithTooltip({
warningMarkdown, warningMarkdown,
size = 24, size = 24,
}: WarningIconWithTooltipProps) { }: WarningIconWithTooltipProps) {
const theme = useTheme();
return ( return (
<Tooltip <Tooltip
id="warning-tooltip" id="warning-tooltip"
title={<SafeMarkdown source={warningMarkdown} />} title={<SafeMarkdown source={warningMarkdown} />}
> >
<Icon <Icon
color={supersetTheme.colors.alert.base} color={theme.colors.alert.base}
height={size} height={size}
width={size} width={size}
name="alert-solid" name="alert-solid"