Added closeDialog prop to tab elements

This commit is contained in:
Adam McQuilkin
2024-01-15 10:21:38 +10:00
committed by Sacha Weatherstone
parent 141b4fbb81
commit 4399d83c1b
4 changed files with 27 additions and 6 deletions
+14 -2
View File
@@ -16,7 +16,19 @@ import {
import { Link } from "@components/UI/Typography/Link.js";
import { Subtle } from "@components/UI/Typography/Subtle.js";
const tabs = [
export interface TabElementProps {
closeDialog: () => void;
}
export interface TabManifest {
label: string;
element: React.FC<TabElementProps>;
disabled: boolean;
disabledMessage: string;
disabledLink?: string;
}
const tabs: TabManifest[] = [
{
label: "HTTP",
element: HTTP,
@@ -74,7 +86,7 @@ export const NewDeviceDialog = ({
{tab.disabledMessage}
</p>
) : (
<tab.element />
<tab.element closeDialog={() => onOpenChange(false)} />
)}
</TabsContent>
))}