| 40 | } |
| 41 | |
| 42 | const ErrorMarkdown = ({ error, send }: Props) => { |
| 43 | React.useEffect(() => { |
| 44 | if (error) { |
| 45 | // log error |
| 46 | logger(`ERROR in markdown: ${error.message}`) |
| 47 | } |
| 48 | }, [error]) |
| 49 | |
| 50 | if (!error) { |
| 51 | return null |
| 52 | } |
| 53 | |
| 54 | return ( |
| 55 | <div css={styles.container}> |
| 56 | <h1>Oops!</h1> |
| 57 | <div css={styles.content}> |
| 58 | <Markdown>{error.message}</Markdown> |
| 59 | </div> |
| 60 | <br /> |
| 61 | <br /> |
| 62 | {/* Actions */} |
| 63 | <div css={styles.options}> |
| 64 | {error.actions && |
| 65 | error.actions.map((a) => ( |
| 66 | <Button type="normal" warning style={styles.button} onClick={() => send({ type: a.transition })}> |
| 67 | {a.label} |
| 68 | </Button> |
| 69 | ))} |
| 70 | </div> |
| 71 | </div> |
| 72 | ) |
| 73 | } |
| 74 | |
| 75 | export default ErrorMarkdown |