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
dde2cfc5
Commit
dde2cfc5
authored
Apr 14, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skeleton for tabs
parent
d07b3303
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
10 deletions
+48
-10
Token.tsx
ui/pages/Token.tsx
+10
-8
RoutedTabs.tsx
ui/shared/RoutedTabs/RoutedTabs.tsx
+1
-0
RoutedTabsMenu.tsx
ui/shared/RoutedTabs/RoutedTabsMenu.tsx
+5
-1
SkeletonTabs.tsx
ui/shared/skeletons/SkeletonTabs.tsx
+32
-1
No files found.
ui/pages/Token.tsx
View file @
dde2cfc5
...
@@ -173,14 +173,16 @@ const TokenPageContent = () => {
...
@@ -173,14 +173,16 @@ const TokenPageContent = () => {
{
/* should stay before tabs to scroll up with pagination */
}
{
/* should stay before tabs to scroll up with pagination */
}
<
Box
ref=
{
scrollRef
}
></
Box
>
<
Box
ref=
{
scrollRef
}
></
Box
>
{
tokenQuery
.
isLoading
||
contractQuery
.
isLoading
?
<
SkeletonTabs
/>
:
(
{
tokenQuery
.
isPlaceholderData
||
contractQuery
.
isPlaceholderData
?
<
RoutedTabs
<
SkeletonTabs
tabs=
{
tabs
}
/>
:
tabs=
{
tabs
}
(
tabListProps=
{
tabListProps
}
<
RoutedTabs
rightSlot=
{
!
isMobile
&&
hasPagination
?
<
Pagination
{
...
(
pagination
as
PaginationProps
)
}
/>
:
null
}
tabs=
{
tabs
}
stickyEnabled=
{
!
isMobile
}
tabListProps=
{
tabListProps
}
/>
rightSlot=
{
!
isMobile
&&
hasPagination
?
<
Pagination
{
...
(
pagination
as
PaginationProps
)
}
/>
:
null
}
)
}
stickyEnabled=
{
!
isMobile
}
/>
)
}
{
!
tokenQuery
.
isLoading
&&
!
tokenQuery
.
isError
&&
<
Box
h=
{
{
base
:
0
,
lg
:
'
40vh
'
}
}
/>
}
{
!
tokenQuery
.
isLoading
&&
!
tokenQuery
.
isError
&&
<
Box
h=
{
{
base
:
0
,
lg
:
'
40vh
'
}
}
/>
}
</>
</>
...
...
ui/shared/RoutedTabs/RoutedTabs.tsx
View file @
dde2cfc5
...
@@ -175,6 +175,7 @@ const RoutedTabs = ({ tabs, tabListProps, rightSlot, stickyEnabled, className, .
...
@@ -175,6 +175,7 @@ const RoutedTabs = ({ tabs, tabListProps, rightSlot, stickyEnabled, className, .
}
}
onItemClick=
{
handleTabChange
}
onItemClick=
{
handleTabChange
}
buttonRef=
{
tabsRefs
[
index
]
}
buttonRef=
{
tabsRefs
[
index
]
}
size=
{
themeProps
.
size
||
'
md
'
}
/>
/>
);
);
}
}
...
...
ui/shared/RoutedTabs/RoutedTabsMenu.tsx
View file @
dde2cfc5
import
type
{
ButtonProps
}
from
'
@chakra-ui/react
'
;
import
{
Popover
,
import
{
Popover
,
PopoverTrigger
,
PopoverTrigger
,
PopoverContent
,
PopoverContent
,
...
@@ -20,9 +22,10 @@ interface Props {
...
@@ -20,9 +22,10 @@ interface Props {
styles
?:
StyleProps
;
styles
?:
StyleProps
;
onItemClick
:
(
index
:
number
)
=>
void
;
onItemClick
:
(
index
:
number
)
=>
void
;
buttonRef
:
React
.
RefObject
<
HTMLButtonElement
>
;
buttonRef
:
React
.
RefObject
<
HTMLButtonElement
>
;
size
:
ButtonProps
[
'
size
'
];
}
}
const
RoutedTabsMenu
=
({
tabs
,
tabsCut
,
isActive
,
styles
,
onItemClick
,
buttonRef
,
activeTab
}:
Props
)
=>
{
const
RoutedTabsMenu
=
({
tabs
,
tabsCut
,
isActive
,
styles
,
onItemClick
,
buttonRef
,
activeTab
,
size
}:
Props
)
=>
{
const
{
isOpen
,
onClose
,
onOpen
}
=
useDisclosure
();
const
{
isOpen
,
onClose
,
onOpen
}
=
useDisclosure
();
const
handleItemClick
=
React
.
useCallback
((
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
const
handleItemClick
=
React
.
useCallback
((
event
:
React
.
MouseEvent
<
HTMLButtonElement
>
)
=>
{
...
@@ -40,6 +43,7 @@ const RoutedTabsMenu = ({ tabs, tabsCut, isActive, styles, onItemClick, buttonRe
...
@@ -40,6 +43,7 @@ const RoutedTabsMenu = ({ tabs, tabsCut, isActive, styles, onItemClick, buttonRe
variant=
"ghost"
variant=
"ghost"
isActive=
{
isOpen
||
isActive
}
isActive=
{
isOpen
||
isActive
}
ref=
{
buttonRef
}
ref=
{
buttonRef
}
size=
{
size
}
{
...
styles
}
{
...
styles
}
>
>
{
menuButton
.
title
}
{
menuButton
.
title
}
...
...
ui/shared/skeletons/SkeletonTabs.tsx
View file @
dde2cfc5
import
{
Flex
,
Skeleton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
{
Flex
,
Skeleton
,
chakra
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
type
{
RoutedTab
}
from
'
../RoutedTabs/types
'
;
interface
Props
{
interface
Props
{
className
?:
string
;
className
?:
string
;
tabs
?:
Array
<
RoutedTab
>
;
size
?:
'
sm
'
|
'
md
'
;
}
}
const
SkeletonTabs
=
({
className
}:
Props
)
=>
{
const
SkeletonTabs
=
({
className
,
tabs
,
size
=
'
md
'
}:
Props
)
=>
{
if
(
tabs
)
{
if
(
tabs
.
length
===
1
)
{
return
null
;
}
const
paddingHor
=
size
===
'
sm
'
?
3
:
4
;
const
paddingVert
=
size
===
'
sm
'
?
1
:
2
;
return
(
<
Flex
className=
{
className
}
my=
{
8
}
alignItems=
"center"
>
{
tabs
.
map
(({
title
,
id
},
index
)
=>
(
<
Skeleton
key=
{
id
}
py=
{
index
===
0
?
paddingVert
:
0
}
px=
{
index
===
0
?
paddingHor
:
0
}
mx=
{
index
===
0
?
0
:
paddingHor
}
borderRadius=
"base"
fontWeight=
{
600
}
borderWidth=
{
size
===
'
sm
'
?
'
2px
'
:
0
}
>
{
typeof
title
===
'
string
'
?
title
:
title
()
}
</
Skeleton
>
))
}
</
Flex
>
);
}
return
(
return
(
<
Flex
my=
{
8
}
className=
{
className
}
>
<
Flex
my=
{
8
}
className=
{
className
}
>
<
Skeleton
h=
{
6
}
my=
{
2
}
mx=
{
4
}
w=
"100px"
/>
<
Skeleton
h=
{
6
}
my=
{
2
}
mx=
{
4
}
w=
"100px"
/>
...
...
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