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
fc2c8161
Commit
fc2c8161
authored
Sep 19, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some tweaks
parent
3e0134e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
RoutedTabs.tsx
ui/shared/RoutedTabs/RoutedTabs.tsx
+1
-9
RoutedTabsMenu.tsx
ui/shared/RoutedTabs/RoutedTabsMenu.tsx
+11
-3
No files found.
ui/shared/RoutedTabs/RoutedTabs.tsx
View file @
fc2c8161
...
@@ -47,14 +47,6 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
...
@@ -47,14 +47,6 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
setActiveTab
(
index
);
setActiveTab
(
index
);
},
[
tabs
,
router
]);
},
[
tabs
,
router
]);
const
handleItemInMenuClick
=
React
.
useCallback
((
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
const
tabIndex
=
(
event
.
target
as
HTMLButtonElement
).
getAttribute
(
'
data-index
'
);
if
(
tabIndex
)
{
handleTabChange
(
tabsCut
+
Number
(
tabIndex
));
}
},
[
handleTabChange
,
tabsCut
]);
return
(
return
(
<
Tabs
variant=
"soft-rounded"
colorScheme=
"blue"
isLazy
onChange=
{
handleTabChange
}
index=
{
activeTab
}
>
<
Tabs
variant=
"soft-rounded"
colorScheme=
"blue"
isLazy
onChange=
{
handleTabChange
}
index=
{
activeTab
}
>
<
TabList
marginBottom=
{
{
base
:
6
,
lg
:
8
}
}
flexWrap=
"nowrap"
whiteSpace=
"nowrap"
ref=
{
listRef
}
>
<
TabList
marginBottom=
{
{
base
:
6
,
lg
:
8
}
}
flexWrap=
"nowrap"
whiteSpace=
"nowrap"
ref=
{
listRef
}
>
...
@@ -74,7 +66,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
...
@@ -74,7 +66,7 @@ const RoutedTabs = ({ tabs, defaultActiveTab }: Props) => {
{
opacity
:
tabsCut
===
0
?
0
:
1
}
:
{
opacity
:
tabsCut
===
0
?
0
:
1
}
:
hiddenItemStyles
hiddenItemStyles
}
}
onItemClick=
{
handle
ItemInMenuClick
}
onItemClick=
{
handle
TabChange
}
buttonRef=
{
tabsRefs
[
index
]
}
buttonRef=
{
tabsRefs
[
index
]
}
/>
/>
);
);
...
...
ui/shared/RoutedTabs/RoutedTabsMenu.tsx
View file @
fc2c8161
...
@@ -18,12 +18,20 @@ interface Props {
...
@@ -18,12 +18,20 @@ interface Props {
tabsCut
:
number
;
tabsCut
:
number
;
isActive
:
boolean
;
isActive
:
boolean
;
styles
?:
StyleProps
;
styles
?:
StyleProps
;
onItemClick
:
(
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
void
;
onItemClick
:
(
index
:
number
)
=>
void
;
buttonRef
:
React
.
RefObject
<
HTMLButtonElement
>
;
buttonRef
:
React
.
RefObject
<
HTMLButtonElement
>
;
}
}
const
RoutedTabsMenu
=
({
tabs
,
tabsCut
,
isActive
,
styles
,
onItemClick
,
buttonRef
,
activeTab
}:
Props
)
=>
{
const
RoutedTabsMenu
=
({
tabs
,
tabsCut
,
isActive
,
styles
,
onItemClick
,
buttonRef
,
activeTab
}:
Props
)
=>
{
const
{
isOpen
,
onToggle
}
=
useDisclosure
();
const
{
isOpen
,
onToggle
,
onClose
}
=
useDisclosure
();
const
handleItemClick
=
React
.
useCallback
((
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
onClose
();
const
tabIndex
=
(
event
.
target
as
HTMLButtonElement
).
getAttribute
(
'
data-index
'
);
if
(
tabIndex
)
{
onItemClick
(
tabsCut
+
Number
(
tabIndex
));
}
},
[
onClose
,
onItemClick
,
tabsCut
]);
return
(
return
(
<
Popover
isLazy
placement=
"bottom-end"
key=
"more"
>
<
Popover
isLazy
placement=
"bottom-end"
key=
"more"
>
...
@@ -44,7 +52,7 @@ const RoutedTabsMenu = ({ tabs, tabsCut, isActive, styles, onItemClick, buttonRe
...
@@ -44,7 +52,7 @@ const RoutedTabsMenu = ({ tabs, tabsCut, isActive, styles, onItemClick, buttonRe
<
Button
<
Button
key=
{
tab
.
routeName
}
key=
{
tab
.
routeName
}
variant=
"subtle"
variant=
"subtle"
onClick=
{
on
ItemClick
}
onClick=
{
handle
ItemClick
}
isActive=
{
activeTab
.
routeName
===
tab
.
routeName
}
isActive=
{
activeTab
.
routeName
===
tab
.
routeName
}
justifyContent=
"left"
justifyContent=
"left"
data
-
index=
{
index
}
data
-
index=
{
index
}
...
...
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