-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
45 lines (38 loc) · 1.45 KB
/
index.tsx
File metadata and controls
45 lines (38 loc) · 1.45 KB
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
import { Button, Input } from 'antd';
import { CloseOutlined } from '@ant-design/icons'
import { useLocalRecipeString, useSetLocalRecipe } from '../../state/store';
import "./style.css";
const { TextArea } = Input;
interface LocalRecipeProps {
startPacking: (recipeId: string, configId: string, recipeString: string) => Promise<void>;
maxHeight?: number;
}
const LocalRecipe: React.FC<LocalRecipeProps> = ({ startPacking, maxHeight }) => {
const localRecipeString = useLocalRecipeString();
const setLocalRecipe = useSetLocalRecipe();
const closeLocalRecipe = () => {
setLocalRecipe(undefined);
};
if (!localRecipeString) {
return <div>No local recipe loaded.</div>;
}
return (
<div className="local-recipe">
<div className="upload-recipe-header">
<h3>Uploaded Recipe</h3>
<Button icon={<CloseOutlined />} onClick={closeLocalRecipe} color="default" variant="text"/>
</div>
<TextArea value={localRecipeString} disabled style={{ height: maxHeight }} />
<Button
className="packing-button"
color="primary"
variant="filled"
style={{ width: "100%", minHeight: 38, marginTop: 6 }}
onClick={() => startPacking("", "", localRecipeString)}
>
<strong>Run Packing</strong>
</Button>
</div>
);
};
export default LocalRecipe;