diff options
author | Michael Muré <batolettre@gmail.com> | 2021-05-02 12:07:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-02 12:07:19 +0200 |
commit | fc2b9e54edb0d728388f7ecafd6e03a5f287811e (patch) | |
tree | 37856fd8a08f0953e4b3b661e46ee2f8d7733e41 /webui/src/components/CommentInput | |
parent | dc875530a41e5a43e5b2932efbb4f957a1bfa9ac (diff) | |
parent | 15132a1533166607e9969506ec91fd9c87a4ed1c (diff) | |
download | git-bug-fc2b9e54edb0d728388f7ecafd6e03a5f287811e.tar.gz |
Merge pull request #661 from GlancingMind/fix-660
Show placeholder for empty comment(preview)
Diffstat (limited to 'webui/src/components/CommentInput')
-rw-r--r-- | webui/src/components/CommentInput/CommentInput.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/webui/src/components/CommentInput/CommentInput.tsx b/webui/src/components/CommentInput/CommentInput.tsx index c0e3edfc..babd495c 100644 --- a/webui/src/components/CommentInput/CommentInput.tsx +++ b/webui/src/components/CommentInput/CommentInput.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; +import { Typography } from '@material-ui/core'; import Tab from '@material-ui/core/Tab'; import Tabs from '@material-ui/core/Tabs'; import TextField from '@material-ui/core/TextField'; @@ -28,6 +29,10 @@ const useStyles = makeStyles((theme) => ({ borderBottom: `solid 3px ${theme.palette.grey['200']}`, minHeight: '5rem', }, + previewPlaceholder: { + color: theme.palette.text.secondary, + fontStyle: 'italic', + }, })); type TabPanelProps = { @@ -103,7 +108,13 @@ function CommentInput({ inputProps, inputText, loading, onChange }: Props) { /> </TabPanel> <TabPanel value={tab} index={1} className={classes.preview}> - <Content markdown={input} /> + {input !== '' ? ( + <Content markdown={input} /> + ) : ( + <Typography className={classes.previewPlaceholder}> + Nothing to preview. + </Typography> + )} </TabPanel> </div> </div> |