Skip to content

Commit 3883952

Browse files
committed
refactor: Simplify NodeDocsDialog close button implementation and remove unused button component
1 parent 84039f0 commit 3883952

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

apps/web/src/components/docs/node-docs-dialog.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import type { NodeType } from "@dafthunk/types";
2-
import { ExternalLink } from "lucide-react";
2+
import { ExternalLink, X } from "lucide-react";
33
// @ts-ignore - https://github.com/lucide-icons/lucide/issues/2867#issuecomment-2847105863
44
import { DynamicIcon } from "lucide-react/dynamic.mjs";
55
import Markdown from "react-markdown";
66

77
import { Badge } from "@/components/ui/badge";
8-
import { Button } from "@/components/ui/button";
98
import {
109
Dialog,
1110
DialogContent,
@@ -30,7 +29,14 @@ export function NodeDocsDialog({
3029
return (
3130
<Dialog open={isOpen} onOpenChange={onOpenChange}>
3231
<DialogContent className="max-w-2xl max-h-[80vh] flex flex-col gap-0">
33-
<DialogHeader className="shrink-0">
32+
<button
33+
className="absolute right-4 top-4 text-muted-foreground hover:text-foreground transition-colors"
34+
onClick={() => onOpenChange(false)}
35+
>
36+
<X className="h-4 w-4" />
37+
<span className="sr-only">Close</span>
38+
</button>
39+
<DialogHeader className="shrink-0 mb-2">
3440
<DialogTitle className="flex items-start gap-3">
3541
<div className="flex items-center gap-2 min-w-0">
3642
<DynamicIcon
@@ -51,6 +57,8 @@ export function NodeDocsDialog({
5157
)}
5258
</DialogHeader>
5359

60+
<Separator />
61+
5462
<div className="flex-1 overflow-y-auto px-1 -mx-1">
5563
<div className="space-y-4 py-4">
5664
{nodeType.documentation && (
@@ -94,7 +102,6 @@ export function NodeDocsDialog({
94102
)}
95103

96104
<>
97-
<Separator />
98105
<div className="space-y-4">
99106
<h4 className="text-sm font-semibold">Parameters</h4>
100107
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
@@ -189,12 +196,6 @@ export function NodeDocsDialog({
189196
</>
190197
</div>
191198
</div>
192-
193-
<div className="flex justify-end gap-2 pt-4 border-t shrink-0">
194-
<Button variant="outline" onClick={() => onOpenChange(false)}>
195-
Close
196-
</Button>
197-
</div>
198199
</DialogContent>
199200
</Dialog>
200201
);

0 commit comments

Comments
 (0)