Skip to content

Commit a9e6699

Browse files
authored
Merge pull request #23 from Terraform-GUI/feature/drag-and-drop
feature(front): #22 - drag and drop ressource
2 parents 14deb32 + 1c3afea commit a9e6699

File tree

17 files changed

+325
-201
lines changed

17 files changed

+325
-201
lines changed

web/package-lock.json

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"@emotion/react": "^11.9.3",
77
"@emotion/styled": "^11.9.3",
8+
"@mui/icons-material": "^5.8.4",
89
"@mui/material": "^5.9.1",
910
"@testing-library/jest-dom": "^5.16.4",
1011
"@testing-library/react": "^13.3.0",

web/src/App.css

Lines changed: 0 additions & 70 deletions
This file was deleted.

web/src/App.test.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

web/src/App.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

web/src/SchemaUI/index.tsx

Lines changed: 0 additions & 100 deletions
This file was deleted.

web/src/components/App.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
3+
import BuilderPage from "../pages/BuilderPage";
4+
5+
function App() {
6+
return (
7+
<>
8+
<BuilderPage />
9+
</>
10+
11+
);
12+
}
13+
14+
export default App;

web/src/components/Description/index.css

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { useState, useRef, useCallback } from 'react';
2+
import './index.css';
3+
4+
const Description = () => {
5+
6+
7+
return (
8+
<div className="description">
9+
<h1>Description</h1>
10+
</div>
11+
);
12+
};
13+
14+
export default Description;
15+
16+
17+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as React from "react";
2+
import AppBar from "@mui/material/AppBar";
3+
import Toolbar from "@mui/material/Toolbar";
4+
import Container from "@mui/material/Container";
5+
import Button from "@mui/material/Button";
6+
7+
import RessourceList from "./ressourceList";
8+
9+
10+
const Header = ({ saves }: any) => {
11+
12+
const save = () => {
13+
saves(true);
14+
};
15+
16+
return (
17+
<div>
18+
<AppBar style={{ backgroundColor: "brown" }} position="static">
19+
<Container maxWidth="xl">
20+
<Toolbar disableGutters>
21+
<RessourceList />
22+
<Button onClick={() => save()}>SAVE</Button>
23+
</Toolbar>
24+
</Container>
25+
</AppBar>
26+
</div>
27+
);
28+
};
29+
export default Header;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from "react";
2+
3+
import Chip from "@mui/material/Chip";
4+
import Stack from "@mui/material/Stack";
5+
6+
const RessourceList = () => {
7+
const onDragStart = (event: any, nodeType: any) => {
8+
event.dataTransfer.setData("application/reactflow", nodeType);
9+
event.dataTransfer.effectAllowed = "move";
10+
};
11+
12+
const handleClicks = () => {
13+
console.info("You clicked the Chip.");
14+
};
15+
16+
return (
17+
<aside>
18+
<Stack direction="row" spacing={1}>
19+
<div onDragStart={(event) => onDragStart(event, "RDS")} draggable>
20+
<Chip label="RDS" variant="outlined" onClick={handleClicks} />
21+
</div>
22+
<div onDragStart={(event) => onDragStart(event, "EC2")} draggable>
23+
<Chip label="EC2" variant="outlined" onClick={handleClicks} />
24+
</div>
25+
<div onDragStart={(event) => onDragStart(event, "SQS")} draggable>
26+
<Chip label="SQS" variant="outlined" onClick={handleClicks} />
27+
</div>
28+
<div onDragStart={(event) => onDragStart(event, "Lambda")} draggable>
29+
<Chip label="Lambda" variant="outlined" onClick={handleClicks} />
30+
</div>
31+
<div onDragStart={(event) => onDragStart(event, "VPC")} draggable>
32+
<Chip label="VPC" variant="outlined" onClick={handleClicks} />
33+
</div>
34+
<div onDragStart={(event) => onDragStart(event, "secretManager")} draggable>
35+
<Chip label="secretManager" variant="outlined" onClick={handleClicks} />
36+
</div>
37+
</Stack>
38+
</aside>
39+
);
40+
};
41+
42+
export default RessourceList;

web/src/components/SchemaUI/index.css

Whitespace-only changes.

0 commit comments

Comments
 (0)