Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
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
LuckySwap
interface
Commits
18f64d6d
Unverified
Commit
18f64d6d
authored
Nov 29, 2022
by
Jack Short
Committed by
GitHub
Nov 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: updating collection loading for mobile (#5434)
parent
af2725ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
84 deletions
+10
-84
CollectionStats.tsx
src/nft/components/collection/CollectionStats.tsx
+10
-11
Marquee.css.ts
src/nft/components/layout/Marquee.css.ts
+0
-26
Marquee.tsx
src/nft/components/layout/Marquee.tsx
+0
-47
No files found.
src/nft/components/collection/CollectionStats.tsx
View file @
18f64d6d
...
@@ -2,7 +2,6 @@ import clsx from 'clsx'
...
@@ -2,7 +2,6 @@ import clsx from 'clsx'
import
{
getDeltaArrow
}
from
'
components/Tokens/TokenDetails/PriceChart
'
import
{
getDeltaArrow
}
from
'
components/Tokens/TokenDetails/PriceChart
'
import
{
Box
,
BoxProps
}
from
'
nft/components/Box
'
import
{
Box
,
BoxProps
}
from
'
nft/components/Box
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
import
{
Column
,
Row
}
from
'
nft/components/Flex
'
import
{
Marquee
}
from
'
nft/components/layout/Marquee
'
import
{
themeVars
}
from
'
nft/css/sprinkles.css
'
import
{
themeVars
}
from
'
nft/css/sprinkles.css
'
import
{
useIsCollectionLoading
}
from
'
nft/hooks/useIsCollectionLoading
'
import
{
useIsCollectionLoading
}
from
'
nft/hooks/useIsCollectionLoading
'
import
{
GenieCollection
,
TokenType
}
from
'
nft/types
'
import
{
GenieCollection
,
TokenType
}
from
'
nft/types
'
...
@@ -255,14 +254,15 @@ const StatsItem = ({ children, label, shouldHide }: { children: ReactNode; label
...
@@ -255,14 +254,15 @@ const StatsItem = ({ children, label, shouldHide }: { children: ReactNode; label
}
}
const
statsLoadingSkeleton
=
(
isMobile
:
boolean
)
=>
const
statsLoadingSkeleton
=
(
isMobile
:
boolean
)
=>
new
Array
(
5
).
fill
(
null
).
map
((
_
,
index
)
=>
(
new
Array
(
isMobile
?
3
:
5
).
fill
(
null
).
map
((
_
,
index
)
=>
(
<
Box
<
Box
display=
"flex"
display=
"flex"
flexDirection=
{
isMobile
?
'
row
'
:
'
column
'
}
flexDirection=
"column"
alignItems=
"baseline"
alignItems=
"baseline"
gap=
"2"
gap=
"2"
height=
"min"
height=
"min"
key=
{
`statsLoadingSkeleton-key-${index}`
}
key=
{
`statsLoadingSkeleton-key-${index}`
}
marginBottom=
{
isMobile
?
'
12
'
:
'
0
'
}
>
>
<
div
className=
{
styles
.
statsLabelLoading
}
/>
<
div
className=
{
styles
.
statsLabelLoading
}
/>
<
span
className=
{
styles
.
statsValueLoading
}
/>
<
span
className=
{
styles
.
statsValueLoading
}
/>
...
@@ -334,7 +334,7 @@ const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMob
...
@@ -334,7 +334,7 @@ const StatsRow = ({ stats, isMobile, ...props }: { stats: GenieCollection; isMob
export
const
CollectionStatsLoading
=
({
isMobile
}:
{
isMobile
:
boolean
})
=>
{
export
const
CollectionStatsLoading
=
({
isMobile
}:
{
isMobile
:
boolean
})
=>
{
return
(
return
(
<
Column
marginTop=
{
isMobile
?
'
20
'
:
'
0
'
}
position=
"relative"
width=
"full"
>
<
Column
position=
"relative"
width=
"full"
>
<
Box
className=
{
styles
.
collectionImageIsLoadingBackground
}
/>
<
Box
className=
{
styles
.
collectionImageIsLoadingBackground
}
/>
<
Box
className=
{
styles
.
collectionImageIsLoading
}
/>
<
Box
className=
{
styles
.
collectionImageIsLoading
}
/>
<
Box
className=
{
styles
.
statsText
}
>
<
Box
className=
{
styles
.
statsText
}
>
...
@@ -342,19 +342,18 @@ export const CollectionStatsLoading = ({ isMobile }: { isMobile: boolean }) => {
...
@@ -342,19 +342,18 @@ export const CollectionStatsLoading = ({ isMobile }: { isMobile: boolean }) => {
{
!
isMobile
&&
(
{
!
isMobile
&&
(
<>
<>
<
CollectionDescriptionLoading
/>
<
CollectionDescriptionLoading
/>
<
Row
gap=
{
{
sm
:
'
20
'
,
md
:
'
60
'
}
}
marginTop=
"20"
>
<
Row
gap=
"60"
marginTop=
"20"
>
{
statsLoadingSkeleton
(
isMobil
e
)
}
{
statsLoadingSkeleton
(
fals
e
)
}
</
Row
>
</
Row
>
</>
</>
)
}
)
}
</
Box
>
</
Box
>
{
isMobile
&&
(
{
isMobile
&&
(
<>
<>
<
Marquee
>
<
CollectionDescriptionLoading
/>
<
Row
gap=
{
{
sm
:
'
20
'
,
md
:
'
60
'
}
}
marginX=
"6"
marginY=
"28"
>
<
Row
gap=
"20"
marginTop=
"20"
>
{
statsLoadingSkeleton
(
isMobile
)
}
{
statsLoadingSkeleton
(
true
)
}
</
Row
>
</
Row
>
</
Marquee
>
</>
</>
)
}
)
}
</
Column
>
</
Column
>
...
...
src/nft/components/layout/Marquee.css.ts
deleted
100644 → 0
View file @
af2725ec
import
{
globalKeyframes
,
style
}
from
'
@vanilla-extract/css
'
import
{
sprinkles
}
from
'
../../css/sprinkles.css
'
globalKeyframes
(
'
scroll
'
,
{
'
0%
'
:
{
transform
:
'
translateX(0%)
'
,
},
'
100%
'
:
{
transform
:
'
translateX(-100%)
'
,
},
})
export
const
marquee
=
style
([
sprinkles
({
minWidth
:
'
full
'
,
zIndex
:
'
1
'
,
display
:
'
flex
'
,
flexDirection
:
'
row
'
,
alignItems
:
'
center
'
,
}),
{
flex
:
'
0 0 auto
'
,
animation
:
'
scroll var(--duration) linear infinite
'
,
},
])
src/nft/components/layout/Marquee.tsx
deleted
100644 → 0
View file @
af2725ec
import
{
Box
}
from
'
nft/components/Box
'
import
*
as
styles
from
'
nft/components/layout/Marquee.css
'
import
{
ReactNode
,
useEffect
,
useRef
,
useState
}
from
'
react
'
export
const
Marquee
=
({
children
,
speed
=
20
}:
{
children
:
ReactNode
;
speed
?:
number
})
=>
{
const
[
duration
,
setDuration
]
=
useState
(
0
)
const
containerRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
)
const
marqueeRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
)
const
updateScrollDuration
=
()
=>
{
let
containerWidth
=
0
let
marqueeWidth
=
0
try
{
if
(
marqueeRef
.
current
&&
containerRef
.
current
)
{
containerWidth
=
containerRef
.
current
.
getBoundingClientRect
().
width
marqueeWidth
=
marqueeRef
.
current
.
getBoundingClientRect
().
width
}
}
catch
(
e
)
{}
if
(
marqueeWidth
<
containerWidth
)
{
setDuration
(
containerWidth
/
speed
)
}
else
{
setDuration
(
marqueeWidth
/
speed
)
}
}
useEffect
(()
=>
{
updateScrollDuration
()
// Rerender on window resize
window
.
addEventListener
(
'
resize
'
,
updateScrollDuration
)
return
()
=>
{
window
.
removeEventListener
(
'
resize
'
,
updateScrollDuration
)
}
})
return
(
<
Box
ref=
{
containerRef
}
overflowX=
"hidden"
display=
"flex"
flexDirection=
"row"
position=
"relative"
width=
"full"
>
<
div
ref=
{
marqueeRef
}
style=
{
{
[
'
--duration
'
as
string
]:
`${duration}s`
}
}
className=
{
styles
.
marquee
}
>
{
children
}
</
div
>
<
div
style=
{
{
[
'
--duration
'
as
string
]:
`${duration}s`
}
}
className=
{
styles
.
marquee
}
>
{
children
}
</
div
>
</
Box
>
)
}
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