Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

Commit

Permalink
fix(taboule): error card ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ascariandrea committed Nov 22, 2022
1 parent 35ed8cf commit 88fc404
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
25 changes: 10 additions & 15 deletions packages/shared/src/components/Error/ErrorBox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Card, CardContent, Typography } from '@material-ui/core';
import { Card } from '@material-ui/core';
import { Alert, AlertTitle } from '@material-ui/lab';
import * as React from 'react';
import { isAPIError } from '../../errors/APIError';
Expand All @@ -10,25 +10,20 @@ export const ErrorBox = (e: unknown): React.ReactElement<any, string> => {
const errorName = isAPIError(e) ? e.name : 'Error';
const message = isAPIError(e) ? e.message : 'Unknown Error';
return (
<Card>
<Alert severity="error">
<Card style={{ height: '100%' }}>
<Alert severity="error" style={{ height: '50%' }}>
<AlertTitle>{errorName}</AlertTitle>
<p>{message}</p>
{isAPIError(e) && e.details.kind === 'DecodingError' ? (
<ul>
{(e.details.errors ?? []).map((d: any) => (
<li key={d}>{d}</li>
))}
</ul>
<div style={{ overflow: 'auto', height: '100%' }}>
<ul>
{((e.details.errors as any[]) ?? []).map((d: any) => (
<li key={d}>{d}</li>
))}
</ul>
</div>
) : null}
</Alert>

<CardContent>
<Typography variant="h6">Debug</Typography>
<pre style={{ backgroundColor: 'white' }}>
<code>{JSON.stringify(e, null, 2)}</code>
</pre>
</CardContent>
</Card>
);
};
1 change: 1 addition & 0 deletions packages/taboule/src/components/ErrorOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ErrorOverlay: React.FC<Error> = (error) => {
style={{
margin: 'auto',
width: '100%',
height: '100%',
}}
>
{ErrorBox(error)}
Expand Down

0 comments on commit 88fc404

Please sign in to comment.