diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-08-16 00:25:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 00:25:25 +0300 |
commit | 1db77b9cc96ee8f7c014f383ae71da0d225a6d6a (patch) | |
tree | 26dd3bc254d4cbe2a53fa12fac97814041565073 /src/components/EmptyState/EmptyState.tsx | |
parent | 694918dcf0565e14dc4cba69e89907be9bed1544 (diff) | |
parent | 6f82250c15d26b8bfaaff07cda9f6b05c53ef2c4 (diff) | |
download | which-ui-1db77b9cc96ee8f7c014f383ae71da0d225a6d6a.tar.gz |
Merge pull request #85 from which-ecosystem/errors
Handle frontend errors
Diffstat (limited to 'src/components/EmptyState/EmptyState.tsx')
-rw-r--r-- | src/components/EmptyState/EmptyState.tsx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/components/EmptyState/EmptyState.tsx b/src/components/EmptyState/EmptyState.tsx index f79a391..7167ba2 100644 --- a/src/components/EmptyState/EmptyState.tsx +++ b/src/components/EmptyState/EmptyState.tsx @@ -1,14 +1,18 @@ import React from 'react'; import { makeStyles } from '@material-ui/core/styles'; +import Image from '../Image/Image'; import Message from '../Message/Message'; import noContentIcon from '../../assets/noContent.svg'; import constructionIcon from '../../assets/construction.svg'; +import serverIcon from '../../assets/server.svg'; +import errorIcon from '../../assets/error.svg'; interface PropTypes { - variant?: 'default' | 'construction'; + variant?: 'default' | 'construction' | 'waiting' | 'error'; message?: string; + smart?: boolean; } const useStyles = makeStyles(theme => ({ @@ -25,16 +29,26 @@ const CONTEXT = { construction: { icon: constructionIcon, tagline: 'Coming soon' + }, + waiting: { + icon: serverIcon, + tagline: 'Waiting for server' + }, + error: { + icon: errorIcon, + tagline: 'Something went wrong' } }; -const EmptyState: React.FC<PropTypes> = ({ variant = 'default', message }) => { +const EmptyState: React.FC<PropTypes> = ({ variant = 'default', smart = false, message }) => { const classes = useStyles(); const { icon, tagline } = CONTEXT[variant]; + const Component = smart ? Image : 'img'; + return ( <Message tagline={tagline} message={message}> - <img src={icon} className={classes.img} alt="No content" /> + <Component src={icon} className={classes.img} alt="No content" /> </Message> ); }; |