-
diff --git a/src/components/generic/ContextItem.tsx b/src/components/generic/ContextItem.tsx
new file mode 100644
index 00000000..739b04ad
--- /dev/null
+++ b/src/components/generic/ContextItem.tsx
@@ -0,0 +1,23 @@
+import type React from 'react';
+
+import { m } from 'framer-motion';
+
+export interface ContextItem {
+ title: string;
+ icon: JSX.Element;
+}
+
+export const ContextItem = ({ title, icon }: ContextItem): JSX.Element => {
+ return (
+
+ );
+};
diff --git a/src/components/generic/ContextMenu.tsx b/src/components/generic/ContextMenu.tsx
index d3c11808..0178163d 100644
--- a/src/components/generic/ContextMenu.tsx
+++ b/src/components/generic/ContextMenu.tsx
@@ -1,91 +1,54 @@
import React from 'react';
-import { m } from 'framer-motion';
import { FiActivity, FiAperture, FiTag } from 'react-icons/fi';
+import { ContextItem } from './ContextItem';
+
export interface ContextMenuProps {
+ items?: JSX.Element;
children: React.ReactNode;
}
-export const ContextMenu = ({ children }: ContextMenuProps): JSX.Element => {
+export const ContextMenu = ({
+ items,
+ children,
+}: ContextMenuProps): JSX.Element => {
const [visible, setVisible] = React.useState(false);
const [position, setPosition] = React.useState({ x: 0, y: 0 });
- const [selectedValue, setSelectedValue] = React.useState
();
- const doSomething = (selectedValue: string) => {
- setSelectedValue(selectedValue);
- };
-
- const showContextMenu = (event: React.MouseEvent) => {
- event.preventDefault();
-
- setVisible(false);
- const newPosition = {
- x: event.pageX,
- y: event.pageY,
- };
-
- setPosition(newPosition);
- setVisible(true);
- };
-
- const hideContextMenu = (event: React.MouseEvent) => {
- setVisible(false);
- };
return (
{
+ e.preventDefault();
+
+ setVisible(false);
+ const newPosition = {
+ x: e.pageX,
+ y: e.pageY,
+ };
+
+ setPosition(newPosition);
+ setVisible(true);
+ }}
+ onClick={(): void => {
+ setVisible(false);
+ }}
>
{children}
- {selectedValue &&
{selectedValue} is selected
}
{visible && (
-
-
-
-
-
-
-
- Menu item 2
-
-
-
-
-
-
-
-
-
- Menu item 3 with a very long name that should wrap
-
-
-
+ {items}
+
} />
+
} />
+
}
+ />
)}
diff --git a/src/components/layout/Sidebar/ButtonNav.tsx b/src/components/layout/Sidebar/ButtonNav.tsx
index 439ec59b..ea035074 100644
--- a/src/components/layout/Sidebar/ButtonNav.tsx
+++ b/src/components/layout/Sidebar/ButtonNav.tsx
@@ -21,7 +21,7 @@ export const ButtonNav = ({
const dispatch = useAppDispatch();
return (
-
+
{
dispatch(toggleMobileNav());
diff --git a/src/components/layout/Sidebar/sections/CollapsibleSection.tsx b/src/components/layout/Sidebar/sections/CollapsibleSection.tsx
index b48ebea9..0020f8b3 100644
--- a/src/components/layout/Sidebar/sections/CollapsibleSection.tsx
+++ b/src/components/layout/Sidebar/sections/CollapsibleSection.tsx
@@ -22,14 +22,14 @@ export const CollapsibleSection = ({
{icon}
@@ -52,7 +52,7 @@ export const CollapsibleSection = ({
{open && (
<>
{actions && (
-
+
{actions}
)}
diff --git a/src/components/layout/Sidebar/sections/ExternalSection.tsx b/src/components/layout/Sidebar/sections/ExternalSection.tsx
index d814cd32..ca114ef0 100644
--- a/src/components/layout/Sidebar/sections/ExternalSection.tsx
+++ b/src/components/layout/Sidebar/sections/ExternalSection.tsx
@@ -24,14 +24,14 @@ export const ExternalSection = ({
>
{icon}
diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx
index a3397945..e87a3a9b 100644
--- a/src/components/layout/index.tsx
+++ b/src/components/layout/index.tsx
@@ -34,7 +34,9 @@ export const Layout = ({
- {children}
+
+ {children}
+
);
diff --git a/src/pages/Extensions/FileBrowser.tsx b/src/pages/Extensions/FileBrowser.tsx
index 7c04f45b..16766665 100644
--- a/src/pages/Extensions/FileBrowser.tsx
+++ b/src/pages/Extensions/FileBrowser.tsx
@@ -39,8 +39,8 @@ export const FileBrowser = (): JSX.Element => {
return (
-
-
+
+
@@ -63,7 +63,7 @@ export const FileBrowser = (): JSX.Element => {
{data?.data.files.map((file) => (