Skip to content

Commit 279354d

Browse files
committed
Refactor styles and layout for dependency graph webview
- Updated CSS styles for top controls and search container to improve layout and user interaction. - Introduced a new class for top controls, enhancing the organization of the webview elements. - Adjusted alignment and spacing for better visual consistency and usability. - Ensured button styles are consistently applied across the webview for improved user experience.
1 parent ebc4ba7 commit 279354d

File tree

1 file changed

+43
-41
lines changed

1 file changed

+43
-41
lines changed

vscode-rescriptdep/src/extension.ts

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -666,38 +666,21 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
666666
user-select: none;
667667
}
668668
669-
.controls {
669+
/* Top controls wrapper */
670+
.top-controls-wrapper {
670671
display: flex;
671-
justify-content: center;
672+
justify-content: space-between;
673+
align-items: center;
672674
margin-bottom: 10px;
673-
gap: 10px;
674-
position: relative;
675-
z-index: 10;
676-
}
677-
678-
button {
679-
background-color: var(--vscode-button-background);
680-
color: var(--vscode-button-foreground);
681-
border: none;
682-
padding: 6px 12px;
683-
border-radius: 4px;
684-
cursor: pointer;
685-
}
686-
687-
button:hover {
688-
background-color: var(--vscode-button-hoverBackground);
675+
width: 100%;
676+
padding: 0 20px;
677+
box-sizing: border-box;
689678
}
690679
691-
.zoom-controls {
692-
display: flex;
693-
gap: 5px;
694-
}
695-
696680
/* Legend styles - changed to lines */
697681
.legend {
698682
display: flex;
699-
justify-content: center;
700-
margin-bottom: 10px;
683+
justify-content: flex-start;
701684
gap: 20px;
702685
position: relative;
703686
z-index: 10;
@@ -717,13 +700,30 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
717700
/* Search filter styles */
718701
.search-container {
719702
display: flex;
720-
justify-content: center;
703+
justify-content: flex-end;
721704
align-items: center;
722-
margin-bottom: 10px;
723705
position: relative;
724706
z-index: 10;
725707
}
726708
709+
button {
710+
background-color: var(--vscode-button-background);
711+
color: var(--vscode-button-foreground);
712+
border: none;
713+
padding: 6px 12px;
714+
border-radius: 4px;
715+
cursor: pointer;
716+
}
717+
718+
button:hover {
719+
background-color: var(--vscode-button-hoverBackground);
720+
}
721+
722+
.zoom-controls {
723+
display: flex;
724+
gap: 5px;
725+
}
726+
727727
.search-input {
728728
padding: 4px 8px;
729729
border-radius: 4px;
@@ -759,8 +759,7 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
759759
.search-message {
760760
position: absolute;
761761
top: 100%;
762-
left: 50%;
763-
transform: translateX(-50%);
762+
left: 0;
764763
font-size: 12px;
765764
color: var(--vscode-inputValidation-errorForeground);
766765
margin-top: 3px;
@@ -774,6 +773,7 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
774773
775774
.search-message.visible {
776775
opacity: 1;
776+
white-space: nowrap;
777777
}
778778
779779
/* Define colors for arrows that match the legend */
@@ -895,21 +895,23 @@ function showDotGraphWebview(context: vscode.ExtensionContext, dotContent: strin
895895
</style>
896896
</head>
897897
<body class="${isDarkTheme ? 'vscode-dark' : 'vscode-light'}">
898-
<div class="legend">
899-
<div class="legend-item">
900-
<div class="legend-line" style="background-color: var(--dependents-color, lightblue);"></div>
901-
<span>Dependents (modules that use the center module)</span>
898+
<div class="top-controls-wrapper">
899+
<div class="legend">
900+
<div class="legend-item">
901+
<div class="legend-line" style="background-color: var(--dependents-color, lightblue);"></div>
902+
<span>Dependents (modules that use the center module)</span>
903+
</div>
904+
<div class="legend-item">
905+
<div class="legend-line" style="background-color: var(--dependencies-color, lightcoral);"></div>
906+
<span>Dependencies (modules used by the center module)</span>
907+
</div>
902908
</div>
903-
<div class="legend-item">
904-
<div class="legend-line" style="background-color: var(--dependencies-color, lightcoral);"></div>
905-
<span>Dependencies (modules used by the center module)</span>
909+
<div class="search-container">
910+
<input type="text" class="search-input" id="module-search" placeholder="Search for module..." />
911+
<button class="search-button" id="search-button">Search</button>
912+
<div class="search-message" id="search-message">Module not found</div>
906913
</div>
907914
</div>
908-
<div class="search-container">
909-
<input type="text" class="search-input" id="module-search" placeholder="Search for module..." />
910-
<button class="search-button" id="search-button">Search</button>
911-
<div class="search-message" id="search-message">Module not found</div>
912-
</div>
913915
<div id="graph-container">
914916
<div id="graph"></div>
915917
<div id="error-container">

0 commit comments

Comments
 (0)