Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
6575bdfd
Unverified
Commit
6575bdfd
authored
Oct 02, 2023
by
tom goriunov
Committed by
GitHub
Oct 02, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'Contract' tab doesn't open from '...' on narrow desktop (#1230)
Fixes #1228
parent
5d628aff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
TabsMenu.tsx
ui/shared/Tabs/TabsMenu.tsx
+1
-1
useAdaptiveTabs.tsx
ui/shared/Tabs/useAdaptiveTabs.tsx
+14
-5
No files found.
ui/shared/Tabs/TabsMenu.tsx
View file @
6575bdfd
...
...
@@ -33,7 +33,7 @@ const TabsMenu = ({ tabs, tabsCut, isActive, styles, onItemClick, buttonRef, act
const
handleItemClick
=
React
.
useCallback
((
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
onClose
();
const
tabIndex
=
(
event
.
target
as
HTMLButtonElement
)
.
getAttribute
(
'
data-index
'
);
const
tabIndex
=
event
.
currentTarget
.
getAttribute
(
'
data-index
'
);
if
(
tabIndex
)
{
onItemClick
(
tabsCut
+
Number
(
tabIndex
));
}
...
...
ui/shared/Tabs/useAdaptiveTabs.tsx
View file @
6575bdfd
...
...
@@ -23,17 +23,26 @@ export default function useAdaptiveTabs(tabs: Array<RoutedTab>, disabled?: boole
return
tabs
.
length
;
}
const
{
visibleNum
}
=
tabWidths
.
slice
(
0
,
-
1
).
reduce
((
result
,
item
,
index
)
=>
{
const
{
visibleNum
}
=
tabWidths
.
slice
(
0
,
-
1
).
reduce
((
result
,
item
,
index
,
array
)
=>
{
if
(
!
item
)
{
return
result
;
}
if
(
result
.
accWidth
+
item
<=
listWidth
-
rightSlotWidth
-
menuWidth
)
{
return
{
visibleNum
:
result
.
visibleNum
+
1
,
accWidth
:
result
.
accWidth
+
item
};
if
(
result
.
visibleNum
<
index
)
{
// means that we haven't increased visibleNum on the previous iteration, so there is no space left
// we skip now till the rest of the loop
return
result
;
}
if
(
result
.
accWidth
+
item
<=
listWidth
-
rightSlotWidth
&&
index
===
tabWidths
.
length
-
2
)
{
return
{
visibleNum
:
result
.
visibleNum
+
1
,
accWidth
:
result
.
accWidth
+
item
};
if
(
index
===
array
.
length
-
1
)
{
// last element
if
(
result
.
accWidth
+
item
<
listWidth
-
rightSlotWidth
)
{
return
{
visibleNum
:
result
.
visibleNum
+
1
,
accWidth
:
result
.
accWidth
+
item
};
}
}
else
{
if
(
result
.
accWidth
+
item
+
menuWidth
<
listWidth
-
rightSlotWidth
)
{
return
{
visibleNum
:
result
.
visibleNum
+
1
,
accWidth
:
result
.
accWidth
+
item
};
}
}
return
result
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment