Skip to content

Commit 6de888c

Browse files
Bogdan TsechoevNikolayS
Bogdan Tsechoev
authored andcommitted
Bot UI: highlighted show/hide code block string
1 parent 978edf9 commit 6de888c

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

ui/packages/platform/src/pages/Bot/Messages/Message/CodeBlock.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import languages from 'react-syntax-highlighter/dist/esm/languages/prism/support
66
import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
77
import FileCopyOutlinedIcon from '@material-ui/icons/FileCopyOutlined';
88
import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline';
9+
import CodeIcon from '@material-ui/icons/Code';
910

1011
const useStyles = makeStyles((theme) => ({
1112
container: {
@@ -38,18 +39,27 @@ const useStyles = makeStyles((theme) => ({
3839
width: '0.813rem',
3940
},
4041
summary: {
42+
color: 'rgb(166, 38, 164)',
4143
textDecoration: 'underline',
4244
textDecorationStyle: 'dotted',
4345
cursor: 'pointer',
4446
backgroundColor: 'transparent',
4547
boxShadow: 'none',
4648
display: 'inline-flex',
47-
minHeight: '32px!important',
49+
minHeight: '2rem!important',
4850
padding: 0,
4951
'&:hover': {
5052
textDecoration: 'none'
5153
}
5254
},
55+
summaryText: {
56+
display: 'inline-flex',
57+
alignItems: 'center'
58+
},
59+
summaryTextIcon: {
60+
marginRight: 8,
61+
fontSize: '1rem'
62+
},
5363
details: {
5464
padding: 0,
5565
backgroundColor: 'transparent'
@@ -117,7 +127,12 @@ export const CodeBlock = memo(({ value, language }: CodeBlockProps) => {
117127
return (
118128
<Accordion expanded={expanded} onChange={handleToggle} className={classes.accordion}>
119129
<AccordionSummary expandIcon={<ExpandMoreIcon />} className={classes.summary}>
120-
<Typography>{expanded ? 'Hide' : 'Show'} code block ({codeLines.length} LOC)</Typography>
130+
<Typography
131+
className={classes.summaryText}
132+
>
133+
<CodeIcon className={classes.summaryTextIcon} />
134+
{expanded ? 'Hide' : 'Show'} code block ({codeLines.length} LOC)
135+
</Typography>
121136
</AccordionSummary>
122137
<AccordionDetails className={classes.details}>
123138
<div className={classes.container}>

0 commit comments

Comments
 (0)