Skip to content

Commit 274ebfc

Browse files
shantanu patilclaude
authored andcommitted
feat: add always-visible expand button to all Mermaid diagrams
- Replace hover-only tooltip with a persistent "Expand" button on every diagram (both zooming-enabled and standard diagrams) - Button uses fullscreen expand icon instead of magnifier for clarity - FullScreenModal now available for all diagrams, not just non-zooming ones - Better visibility with bg-popover/95, backdrop-blur, shadow, and border - Helps developers view complex project diagrams in a larger viewport Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9c3cdc6 commit 274ebfc

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

src/components/Mermaid.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -865,28 +865,29 @@ const Mermaid: React.FC<MermaidProps> = ({ chart, className = '', zoomingEnabled
865865
title={zoomingEnabled ? undefined : "Click to view fullscreen"}
866866
/>
867867

868-
{!zoomingEnabled && (
869-
<div className="absolute top-3 right-3 bg-popover/90 backdrop-blur-sm text-popover-foreground px-3 py-2 rounded-md opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center gap-2 text-xs font-medium shadow-lg border border-border pointer-events-none">
870-
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
871-
<circle cx="11" cy="11" r="8"></circle>
872-
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
873-
<line x1="11" y1="8" x2="11" y2="14"></line>
874-
<line x1="8" y1="11" x2="14" y2="11"></line>
875-
</svg>
876-
<span>Click to expand</span>
877-
</div>
878-
)}
868+
{/* Always-visible expand button for all diagrams */}
869+
<button
870+
onClick={handleDiagramClick}
871+
className="absolute top-3 right-3 bg-popover/95 backdrop-blur-sm text-popover-foreground px-3 py-2 rounded-md flex items-center gap-2 text-xs font-medium shadow-lg border border-border hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer z-10"
872+
aria-label="Expand diagram"
873+
>
874+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
875+
<polyline points="15 3 21 3 21 9"></polyline>
876+
<polyline points="9 21 3 21 3 15"></polyline>
877+
<line x1="21" y1="3" x2="14" y2="10"></line>
878+
<line x1="3" y1="21" x2="10" y2="14"></line>
879+
</svg>
880+
<span>Expand</span>
881+
</button>
879882
</div>
880883
</div>
881884

882-
{!zoomingEnabled && (
883-
<FullScreenModal
884-
isOpen={isFullscreen}
885-
onClose={() => setIsFullscreen(false)}
886-
>
887-
<div className="mermaid-diagram-container" dangerouslySetInnerHTML={{ __html: svg }} />
888-
</FullScreenModal>
889-
)}
885+
<FullScreenModal
886+
isOpen={isFullscreen}
887+
onClose={() => setIsFullscreen(false)}
888+
>
889+
<div className="mermaid-diagram-container" dangerouslySetInnerHTML={{ __html: svg }} />
890+
</FullScreenModal>
890891
</>
891892
);
892893
};

0 commit comments

Comments
 (0)