blob: 53c6cec842b3432072017890c67074cfe5845af5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import { Button } from '@mui/material';
import { ImageUtility } from './generativeFillUtils/ImageHandler';
import { canvasSize } from './generativeFillUtils/generativeFillConstants';
import { Oval } from 'react-loader-spinner';
import './GenerativeFillButtons.scss';
import React = require('react');
import { Doc } from '../../../../fields/Doc';
interface ButtonContainerProps {
canvasRef: React.RefObject<HTMLCanvasElement>;
currImg: React.MutableRefObject<HTMLImageElement | null>;
getEdit: () => Promise<void>;
loading: boolean;
onSave: () => Promise<void>;
onReset: () => void;
}
const Buttons = ({ canvasRef, currImg, loading, getEdit, onSave, onReset }: ButtonContainerProps) => {
const handleSave = () => {
onSave();
};
return (
<div className="generativeFillBtnContainer">
<Button onClick={onReset}>Reset</Button>
{/* <Button onClick={handleSave}>Save</Button> */}
{/* <Button
onClick={() => {
if (!canvasRef.current) return;
ImageUtility.downloadImageCanvas('/assets/firefly.png');
}}>
Download Original
</Button> */}
<Button
variant="contained"
onClick={() => {
getEdit();
}}>
<span style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>
Get Edit
{loading && <Oval height={20} width={20} color="#ffffff" visible={true} ariaLabel="oval-loading" secondaryColor="#ffffff89" strokeWidth={3} strokeWidthSecondary={3} />}
</span>
</Button>
</div>
);
};
export default Buttons;
|