Skip to content

Commit 2322fea

Browse files
committed
feat: enhance context menu and tab functionality
- Refactored TabContextMenu and Tabs components to improve user interaction with context menus. - Introduced a new Popover component for better positioning and handling of context menus. - Updated styles for context menus to ensure consistency and responsiveness across different screen sizes. - Added functionality for dynamic context menu items based on user actions, including rename and delete options. - Improved tooltip display logic in Tabs component for better user experience with long pad names.
1 parent d21232a commit 2322fea

File tree

3 files changed

+372
-119
lines changed

3 files changed

+372
-119
lines changed
Lines changed: 104 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
.tab-context-menu {
1+
/* Unified context menu styles */
2+
3+
/* Base context menu container */
4+
.tab-context-menu,
5+
.context-menu {
26
position: fixed;
37
border-radius: 4px;
48
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
@@ -13,11 +17,20 @@
1317
cursor: default;
1418
}
1519

20+
/* Context menu list */
21+
.context-menu {
22+
padding: 0;
23+
margin: 0;
24+
}
25+
26+
/* Button text color */
1627
.tab-context-menu button {
1728
color: var(--popup-text-color, #333);
1829
}
1930

20-
.tab-context-menu .menu-item {
31+
/* Menu items */
32+
.tab-context-menu .menu-item,
33+
.context-menu-item {
2134
position: relative;
2235
width: 100%;
2336
min-width: 9.5rem;
@@ -30,73 +43,118 @@
3043
white-space: nowrap;
3144
font-family: inherit;
3245
cursor: pointer;
46+
}
3347

48+
/* Menu item layout for tab context menu */
49+
.tab-context-menu .menu-item {
3450
display: grid;
3551
grid-template-columns: 1fr 0.2fr;
3652
align-items: center;
53+
}
3754

38-
.menu-item__label {
39-
justify-self: start;
40-
margin-inline-end: 20px;
41-
}
42-
43-
&.delete {
44-
.menu-item__label {
45-
color: #e53935;
46-
}
47-
}
55+
/* Menu item layout for context menu */
56+
.context-menu-item {
57+
display: flex;
58+
justify-content: space-between;
59+
align-items: center;
4860
}
4961

50-
.tab-context-menu .menu-item:hover {
62+
/* Menu item label */
63+
.tab-context-menu .menu-item .menu-item__label {
64+
justify-self: start;
65+
margin-inline-end: 20px;
66+
}
67+
68+
.context-menu-item__label {
69+
flex: 1;
70+
}
71+
72+
/* Delete item styling */
73+
.tab-context-menu .menu-item.delete .menu-item__label,
74+
.context-menu-item.dangerous {
75+
color: #e53935;
76+
}
77+
78+
/* Hover states */
79+
.tab-context-menu .menu-item:hover,
80+
.context-menu-item:hover {
5181
color: var(--popup-bg-color, #fff);
5282
background-color: var(--select-highlight-color, #f5f5f5);
83+
}
5384

54-
&.delete {
55-
.menu-item__label {
56-
color: var(--popup-bg-color, #fff);
57-
}
58-
background-color: #e53935;
59-
}
85+
/* Dangerous hover states */
86+
.tab-context-menu .menu-item.delete:hover,
87+
.context-menu-item.dangerous:hover {
88+
background-color: #e53935;
89+
}
90+
91+
.tab-context-menu .menu-item.delete:hover .menu-item__label,
92+
.context-menu-item.dangerous:hover {
93+
color: var(--popup-bg-color, #fff);
6094
}
6195

96+
/* Focus state */
6297
.tab-context-menu .menu-item:focus {
6398
z-index: 1;
6499
}
65100

66-
@media (max-width: 640px) {
67-
.tab-context-menu .menu-item {
68-
display: block;
101+
/* Separator */
102+
.context-menu-item-separator {
103+
margin: 0.25rem 0;
104+
border: none;
105+
border-top: 1px solid var(--button-gray-3, #ccc);
106+
}
69107

70-
.menu-item__label {
71-
margin-inline-end: 0;
72-
}
73-
}
108+
/* Shortcut display */
109+
.context-menu-item__shortcut {
110+
margin-left: 1rem;
111+
color: var(--text-color-secondary, #666);
112+
font-size: 0.8rem;
113+
}
114+
115+
/* Checkmark for selected items */
116+
.context-menu-item.checkmark::before {
117+
content: "";
118+
position: absolute;
119+
left: 0.5rem;
74120
}
75121

122+
/* Form styling for rename functionality */
76123
.tab-context-menu form {
77124
padding: 0.5rem 1rem;
78125
display: flex;
79-
80-
input {
81-
flex: 1;
82-
padding: 0.25rem 0.5rem;
83-
border: 1px solid var(--button-gray-3, #ccc);
84-
border-radius: 4px;
85-
margin-right: 0.25rem;
86-
background-color: var(--input-bg-color, #fff);
87-
color: var(--text-color-primary, #333);
126+
}
127+
128+
.tab-context-menu form input {
129+
flex: 1;
130+
padding: 0.25rem 0.5rem;
131+
border: 1px solid var(--button-gray-3, #ccc);
132+
border-radius: 4px;
133+
margin-right: 0.25rem;
134+
background-color: var(--input-bg-color, #fff);
135+
color: var(--text-color-primary, #333);
136+
}
137+
138+
.tab-context-menu form button {
139+
background-color: var(--color-surface-primary-container, #4285f4);
140+
color: var(--color-on-primary-container, white);
141+
border: none;
142+
border-radius: 4px;
143+
padding: 0.25rem 0.5rem;
144+
cursor: pointer;
145+
}
146+
147+
.tab-context-menu form button:hover {
148+
background-color: var(--color-primary-light, #3367d6);
149+
}
150+
151+
/* Responsive adjustments */
152+
@media (max-width: 640px) {
153+
.tab-context-menu .menu-item {
154+
display: block;
88155
}
89156

90-
button {
91-
background-color: var(--color-surface-primary-container, #4285f4);
92-
color: var(--color-on-primary-container, white);
93-
border: none;
94-
border-radius: 4px;
95-
padding: 0.25rem 0.5rem;
96-
cursor: pointer;
97-
98-
&:hover {
99-
background-color: var(--color-primary-light, #3367d6);
100-
}
157+
.tab-context-menu .menu-item .menu-item__label {
158+
margin-inline-end: 0;
101159
}
102160
}

0 commit comments

Comments
 (0)