Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: error alert levels again #17027

Merged
merged 1 commit into from
Oct 11, 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 @@ -51,17 +51,18 @@ interface BasicErrorAlertProps {

export default function BasicErrorAlert({
body,
level,
level = 'error',
title,
}: BasicErrorAlertProps) {
const theme = useTheme();
const iconColor = theme.colors[level].base;

return (
<StyledContainer level={level} role="alert">
{!level || level === 'error' ? (
<Icons.ErrorSolid iconColor={theme.colors.error.base} />
{level === 'error' ? (
<Icons.ErrorSolid iconColor={iconColor} />
) : (
<Icons.WarningSolid iconColor={theme.colors[level].base} />
<Icons.WarningSolid iconColor={iconColor} />
)}
<StyledContent>
<StyledTitle>{title}</StyledTitle>
Expand Down
27 changes: 8 additions & 19 deletions superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface ErrorAlertProps {
export default function ErrorAlert({
body,
copyText,
level,
level = 'error',
source = 'dashboard',
subtitle,
title,
Expand All @@ -103,21 +103,16 @@ export default function ErrorAlert({
const [isBodyExpanded, setIsBodyExpanded] = useState(false);

const isExpandable = ['explore', 'sqllab'].includes(source);
const iconColor = theme.colors[level].base;

return (
<ErrorAlertDiv level={level} role="alert">
<div className="top-row">
<LeftSideContent>
{!level || level === 'error' ? (
<Icons.ErrorSolid
className="icon"
iconColor={theme.colors.error.base}
/>
{level === 'error' ? (
<Icons.ErrorSolid className="icon" iconColor={iconColor} />
) : (
<Icons.WarningSolid
className="icon"
iconColor={theme.colors[level].base}
/>
<Icons.WarningSolid className="icon" iconColor={iconColor} />
)}
<strong>{title}</strong>
</LeftSideContent>
Expand Down Expand Up @@ -171,16 +166,10 @@ export default function ErrorAlert({
onHide={() => setIsModalOpen(false)}
title={
<div className="header">
{!level || level === 'error' ? (
<Icons.ErrorSolid
className="icon"
iconColor={theme.colors.error.base}
/>
{level === 'error' ? (
<Icons.ErrorSolid className="icon" iconColor={iconColor} />
) : (
<Icons.WarningSolid
className="icon"
iconColor={theme.colors[level].base}
/>
<Icons.WarningSolid className="icon" iconColor={iconColor} />
)}
<div className="title">{title}</div>
</div>
Expand Down