Skip to content

Commit

Permalink
chore: removing use of supersetTheme in favor of ThemeProvider (#17000)
Browse files Browse the repository at this point in the history
  • Loading branch information
rusackas authored Oct 7, 2021
1 parent cde4cdc commit 66fbce9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { styled, supersetTheme } from '@superset-ui/core';
import { styled, useTheme } from '@superset-ui/core';
import Icons from 'src/components/Icons';
import { ErrorLevel } from './types';

Expand Down Expand Up @@ -54,12 +54,14 @@ export default function BasicErrorAlert({
level,
title,
}: BasicErrorAlertProps) {
const theme = useTheme();

return (
<StyledContainer level={level} role="alert">
{level === 'error' ? (
<Icons.ErrorSolid iconColor={supersetTheme.colors[level].base} />
<Icons.ErrorSolid iconColor={theme.colors[level].base} />
) : (
<Icons.WarningSolid iconColor={supersetTheme.colors[level].base} />
<Icons.WarningSolid iconColor={theme.colors[level].base} />
)}
<StyledContent>
<StyledTitle>{title}</StyledTitle>
Expand Down
12 changes: 7 additions & 5 deletions superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React, { useState, ReactNode } from 'react';
import { styled, supersetTheme, t } from '@superset-ui/core';
import { styled, useTheme, t } from '@superset-ui/core';
import { noOp } from 'src/utils/common';
import Modal from 'src/components/Modal';
import Button from 'src/components/Button';
Expand Down Expand Up @@ -97,6 +97,8 @@ export default function ErrorAlert({
subtitle,
title,
}: ErrorAlertProps) {
const theme = useTheme();

const [isModalOpen, setIsModalOpen] = useState(false);
const [isBodyExpanded, setIsBodyExpanded] = useState(false);

Expand All @@ -109,12 +111,12 @@ export default function ErrorAlert({
{level === 'error' ? (
<Icons.ErrorSolid
className="icon"
iconColor={supersetTheme.colors[level].base}
iconColor={theme.colors[level].base}
/>
) : (
<Icons.WarningSolid
className="icon"
iconColor={supersetTheme.colors[level].base}
iconColor={theme.colors[level].base}
/>
)}
<strong>{title}</strong>
Expand Down Expand Up @@ -172,12 +174,12 @@ export default function ErrorAlert({
{level === 'error' ? (
<Icons.ErrorSolid
className="icon"
iconColor={supersetTheme.colors[level].base}
iconColor={theme.colors[level].base}
/>
) : (
<Icons.WarningSolid
className="icon"
iconColor={supersetTheme.colors[level].base}
iconColor={theme.colors[level].base}
/>
)}
<div className="title">{title}</div>
Expand Down

0 comments on commit 66fbce9

Please sign in to comment.