-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.js
124 lines (115 loc) · 3.6 KB
/
App.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import React, { lazy, Suspense } from "react";
import { Box, Grommet, Heading, Paragraph } from "grommet";
import { grommet, dark } from "grommet/themes";
import {
RedditShareButton,
RedditIcon,
TwitterShareButton,
TwitterIcon,
LinkedinShareButton,
LinkedinIcon,
} from "react-share";
import firebase from "./firebase";
import Page from "./components/Page";
import CardPlaceHolder from "./components/CardPlaceHolder";
import ErrorBoundary from "./components/ErrorBoundary";
const OffensiveTerraformModuleCard = lazy(() =>
import("./components/OffensiveTerraformModuleCard")
);
const THEMES = {
grommet,
dark,
};
const share = {
url: "offensive-terraform.github.io",
iconSize: 60,
round: true,
bgColor: "#333333",
};
function App() {
const [themeName, setThemeName] = React.useState("grommet");
const [themeChecked, setThemeChecked] = React.useState(true);
const [data, setData] = React.useState([]);
React.useEffect(() => {
const fetchData = async () => {
const db = firebase.firestore();
const response = await db.collection("modules").get();
setData(response.docs.map((doc) => doc.data()));
};
fetchData();
}, []);
const handleThemeChange = (checked) => {
if (checked) {
setThemeName("grommet");
} else {
setThemeName("dark");
}
setThemeChecked(checked);
};
return (
<Grommet theme={THEMES[themeName || "grommet"]}>
<Page themeChecked={themeChecked} onThemeChange={handleThemeChange}>
<Box flex align="center" justify="center">
<Heading level="1" size="large" textAlign="center" margin="none">
Offensive Terraform Modules
</Heading>
<Paragraph size="xxlarge" textAlign="center">
Automated multi step offensive attack modules with Infrastructure as
Code(IaC)
</Paragraph>
<Paragraph>
<Box direction="row" gap="small">
<RedditShareButton url={share.url}>
<RedditIcon
size={share.iconSize}
round={share.round}
bgStyle={{ fill: share.bgColor }}
/>
</RedditShareButton>
<TwitterShareButton url={share.url}>
<TwitterIcon
size={share.iconSize}
round={share.round}
bgStyle={{ fill: share.bgColor }}
/>
</TwitterShareButton>
<LinkedinShareButton url={share.url}>
<LinkedinIcon
size={share.iconSize}
round={share.round}
bgStyle={{ fill: share.bgColor }}
/>
</LinkedinShareButton>
</Box>
</Paragraph>
</Box>
<Box>
<Box flex direction="row" justify="center" wrap={true}>
{data.map((offensiveModule, index) => (
<ErrorBoundary key={index}>
<Suspense fallback={<CardPlaceHolder />} key={index}>
<OffensiveTerraformModuleCard
offensiveModule={offensiveModule}
key={index}
/>
</Suspense>
</ErrorBoundary>
))}
</Box>
</Box>
<Box>
<Heading level="1" size="large" textAlign="center">
<span role="img" aria-label="happy hacking">
🤘
</span>
Happy Hacking!
<span role="img" aria-label="happy hacking">
🤩
</span>
</Heading>
</Box>
</Page>
</Grommet>
);
}
export default App;