Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

chore: removing use of supersetTheme in favor of ThemeProvider #17000

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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