aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/GenerateButton.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-10-01 13:45:56 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-10-03 20:06:53 +0200
commitb7436a1934cdff6d558abc262776c3a2d21df8f7 (patch)
tree86368c4484613ae707ca1c50a73173be1c6ca638 /subprojects/frontend/src/editor/GenerateButton.tsx
parentfix(frontend): editor selection visibility (diff)
downloadrefinery-b7436a1934cdff6d558abc262776c3a2d21df8f7.tar.gz
refinery-b7436a1934cdff6d558abc262776c3a2d21df8f7.tar.zst
refinery-b7436a1934cdff6d558abc262776c3a2d21df8f7.zip
feat(frontend): animate GenerateButton
Diffstat (limited to 'subprojects/frontend/src/editor/GenerateButton.tsx')
-rw-r--r--subprojects/frontend/src/editor/GenerateButton.tsx15
1 files changed, 8 insertions, 7 deletions
diff --git a/subprojects/frontend/src/editor/GenerateButton.tsx b/subprojects/frontend/src/editor/GenerateButton.tsx
index 485989b5..8b6ae660 100644
--- a/subprojects/frontend/src/editor/GenerateButton.tsx
+++ b/subprojects/frontend/src/editor/GenerateButton.tsx
@@ -1,8 +1,10 @@
1import DangerousOutlinedIcon from '@mui/icons-material/DangerousOutlined';
1import PlayArrowIcon from '@mui/icons-material/PlayArrow'; 2import PlayArrowIcon from '@mui/icons-material/PlayArrow';
2import Button from '@mui/material/Button'; 3import Button from '@mui/material/Button';
3import { observer } from 'mobx-react-lite'; 4import { observer } from 'mobx-react-lite';
4import React from 'react'; 5import React from 'react';
5 6
7import AnimatedButton from './AnimatedButton';
6import type EditorStore from './EditorStore'; 8import type EditorStore from './EditorStore';
7 9
8const GENERATE_LABEL = 'Generate'; 10const GENERATE_LABEL = 'Generate';
@@ -16,7 +18,7 @@ const GenerateButton = observer(function GenerateButton({
16}): JSX.Element { 18}): JSX.Element {
17 if (editorStore === undefined) { 19 if (editorStore === undefined) {
18 return ( 20 return (
19 <Button color="inherit" className="rounded" disabled> 21 <Button color="inherit" variant="outlined" className="rounded" disabled>
20 Loading&hellip; 22 Loading&hellip;
21 </Button> 23 </Button>
22 ); 24 );
@@ -35,26 +37,25 @@ const GenerateButton = observer(function GenerateButton({
35 37
36 if (errorCount > 0) { 38 if (errorCount > 0) {
37 return ( 39 return (
38 <Button 40 <AnimatedButton
39 aria-label={`Select next diagnostic out of ${summary}`} 41 aria-label={`Select next diagnostic out of ${summary}`}
40 onClick={() => editorStore.nextDiagnostic()} 42 onClick={() => editorStore.nextDiagnostic()}
41 color="error" 43 color="error"
42 className="rounded" 44 startIcon={<DangerousOutlinedIcon />}
43 > 45 >
44 {summary} 46 {summary}
45 </Button> 47 </AnimatedButton>
46 ); 48 );
47 } 49 }
48 50
49 return ( 51 return (
50 <Button 52 <AnimatedButton
51 disabled={!editorStore.opened} 53 disabled={!editorStore.opened}
52 color={warningCount > 0 ? 'warning' : 'primary'} 54 color={warningCount > 0 ? 'warning' : 'primary'}
53 className="rounded"
54 startIcon={<PlayArrowIcon />} 55 startIcon={<PlayArrowIcon />}
55 > 56 >
56 {summary === '' ? GENERATE_LABEL : `${GENERATE_LABEL} (${summary})`} 57 {summary === '' ? GENERATE_LABEL : `${GENERATE_LABEL} (${summary})`}
57 </Button> 58 </AnimatedButton>
58 ); 59 );
59}); 60});
60 61