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
da012542
Unverified
Commit
da012542
authored
Nov 18, 2022
by
Mike Grabowski
Committed by
GitHub
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add floor change on mobile (#5302)
* few more tweaks * remove extra code
parent
54a7b943
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
21 deletions
+48
-21
Cells.tsx
src/nft/components/explore/Cells/Cells.tsx
+18
-13
CollectionTable.tsx
src/nft/components/explore/CollectionTable.tsx
+13
-5
Table.tsx
src/nft/components/explore/Table.tsx
+3
-3
index.tsx
src/theme/components/index.tsx
+7
-0
text.tsx
src/theme/components/text.tsx
+7
-0
No files found.
src/nft/components/explore/Cells/Cells.tsx
View file @
da012542
...
@@ -120,9 +120,12 @@ export const EthCell = ({
...
@@ -120,9 +120,12 @@ export const EthCell = ({
:
ethNumberStandardFormatter
(
denominatedValue
,
true
,
false
,
true
)
:
ethNumberStandardFormatter
(
denominatedValue
,
true
,
false
,
true
)
:
'
-
'
:
'
-
'
const
isMobile
=
useIsMobile
()
const
TextComponent
=
isMobile
?
ThemedText
.
BodySmall
:
ThemedText
.
BodyPrimary
return
(
return
(
<
EthContainer
>
<
EthContainer
>
<
T
hemedText
.
BodyPrimary
>
{
value
?
formattedValue
:
'
-
'
}
</
ThemedText
.
BodyPrimary
>
<
T
extComponent
>
{
value
?
formattedValue
:
'
-
'
}
</
TextComponent
>
</
EthContainer
>
</
EthContainer
>
)
)
}
}
...
@@ -153,15 +156,17 @@ export const VolumeCell = ({
...
@@ -153,15 +156,17 @@ export const VolumeCell = ({
)
)
}
}
export
const
ChangeCell
=
({
change
,
children
}:
{
children
?:
ReactNode
;
change
?:
number
})
=>
(
export
const
ChangeCell
=
({
change
,
children
}:
{
children
?:
ReactNode
;
change
?:
number
})
=>
{
<
ChangeCellContainer
change=
{
change
??
0
}
>
const
isMobile
=
useIsMobile
()
{
!
change
||
change
>
0
?
(
const
TextComponent
=
isMobile
?
ThemedText
.
Caption
:
ThemedText
.
BodyPrimary
<
SquareArrowUpIcon
width=
"20px"
height=
"20px"
/>
return
(
)
:
(
<
ChangeCellContainer
change=
{
change
??
0
}
>
<
SquareArrowDownIcon
width=
"20px"
height=
"20px"
/>
{
!
change
||
change
>
0
?
(
)
}
<
SquareArrowUpIcon
width=
"20px"
height=
"20px"
/>
<
ThemedText
.
BodyPrimary
color=
"currentColor"
>
)
:
(
{
children
||
`${change ? Math.abs(Math.round(change)) : 0}%`
}
<
SquareArrowDownIcon
width=
"20px"
height=
"20px"
/>
</
ThemedText
.
BodyPrimary
>
)
}
</
ChangeCellContainer
>
<
TextComponent
color=
"currentColor"
>
{
children
||
`${change ? Math.abs(Math.round(change)) : 0}%`
}
</
TextComponent
>
)
</
ChangeCellContainer
>
)
}
src/nft/components/explore/CollectionTable.tsx
View file @
da012542
...
@@ -2,6 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
...
@@ -2,6 +2,7 @@ import { BigNumber } from '@ethersproject/bignumber'
import
{
CollectionTableColumn
,
TimePeriod
}
from
'
nft/types
'
import
{
CollectionTableColumn
,
TimePeriod
}
from
'
nft/types
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
{
CellProps
,
Column
,
Row
}
from
'
react-table
'
import
{
CellProps
,
Column
,
Row
}
from
'
react-table
'
import
{
MediumOnly
}
from
'
theme/components
'
import
{
ChangeCell
,
CollectionTitleCell
,
DiscreteNumberCell
,
EthCell
,
TextCell
,
VolumeCell
}
from
'
./Cells/Cells
'
import
{
ChangeCell
,
CollectionTitleCell
,
DiscreteNumberCell
,
EthCell
,
TextCell
,
VolumeCell
}
from
'
./Cells/Cells
'
import
{
Table
}
from
'
./Table
'
import
{
Table
}
from
'
./Table
'
...
@@ -65,11 +66,18 @@ const CollectionTable = ({ data, timePeriod }: { data: CollectionTableColumn[];
...
@@ -65,11 +66,18 @@ const CollectionTable = ({ data, timePeriod }: { data: CollectionTableColumn[];
sortType
:
floorSort
,
sortType
:
floorSort
,
Cell
:
function
ethCell
(
cell
:
CellProps
<
CollectionTableColumn
>
)
{
Cell
:
function
ethCell
(
cell
:
CellProps
<
CollectionTableColumn
>
)
{
return
(
return
(
<
EthCell
<>
value=
{
cell
.
row
.
original
.
floor
.
value
}
<
EthCell
denomination=
{
cell
.
row
.
original
.
denomination
}
value=
{
cell
.
row
.
original
.
floor
.
value
}
usdPrice=
{
cell
.
row
.
original
.
usdPrice
}
denomination=
{
cell
.
row
.
original
.
denomination
}
/>
usdPrice=
{
cell
.
row
.
original
.
usdPrice
}
/>
{
timePeriod
!==
TimePeriod
.
AllTime
&&
(
<
MediumOnly
>
<
ChangeCell
change=
{
cell
.
row
.
original
.
floor
.
change
}
/>
</
MediumOnly
>
)
}
</>
)
)
},
},
},
},
...
...
src/nft/components/explore/Table.tsx
View file @
da012542
...
@@ -130,11 +130,11 @@ export function Table<D extends Record<string, unknown>>({
...
@@ -130,11 +130,11 @@ export function Table<D extends Record<string, unknown>>({
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
width
)
return
if
(
!
width
)
return
if
(
width
<
theme
.
breakpoint
.
sm
)
{
if
(
width
<
=
theme
.
breakpoint
.
sm
)
{
setHiddenColumns
(
smallHiddenColumns
)
setHiddenColumns
(
smallHiddenColumns
)
}
else
if
(
width
<
theme
.
breakpoint
.
md
)
{
}
else
if
(
width
<
=
theme
.
breakpoint
.
md
)
{
setHiddenColumns
(
mediumHiddenColumns
)
setHiddenColumns
(
mediumHiddenColumns
)
}
else
if
(
width
<
theme
.
breakpoint
.
lg
)
{
}
else
if
(
width
<
=
theme
.
breakpoint
.
lg
)
{
setHiddenColumns
(
largeHiddenColumns
)
setHiddenColumns
(
largeHiddenColumns
)
}
else
{
}
else
{
setHiddenColumns
([])
setHiddenColumns
([])
...
...
src/theme/components/index.tsx
View file @
da012542
...
@@ -465,6 +465,13 @@ export const SmallOnly = styled.span`
...
@@ -465,6 +465,13 @@ export const SmallOnly = styled.span`
`
};
`
};
`
`
export const MediumOnly = styled.span`
display
:
none
;
@
media
(
max
-
width
:
$
{({
theme
})
=>
theme
.
breakpoint
.
md
}
px
)
{
display
:
block
;
}
`
export const Separator = styled.div`
export const Separator = styled.div`
width
:
100
%
;
width
:
100
%
;
height
:
1
px
;
height
:
1
px
;
...
...
src/theme/components/text.tsx
View file @
da012542
...
@@ -14,12 +14,19 @@ type TextProps = Omit<TextPropsOriginal, 'css'>
...
@@ -14,12 +14,19 @@ type TextProps = Omit<TextPropsOriginal, 'css'>
// todo: export each component individually
// todo: export each component individually
export
const
ThemedText
=
{
export
const
ThemedText
=
{
// todo: there should be just one `Body` with default color, no need to make all variations
BodyPrimary
(
props
:
TextProps
)
{
BodyPrimary
(
props
:
TextProps
)
{
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
16
}
color=
"textPrimary"
{
...
props
}
/>
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
16
}
color=
"textPrimary"
{
...
props
}
/>
},
},
BodySecondary
(
props
:
TextProps
)
{
BodySecondary
(
props
:
TextProps
)
{
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
16
}
color=
"textSecondary"
{
...
props
}
/>
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
16
}
color=
"textSecondary"
{
...
props
}
/>
},
},
BodySmall
(
props
:
TextProps
)
{
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
14
}
color=
"textPrimary"
{
...
props
}
/>
},
Caption
(
props
:
TextProps
)
{
return
<
TextWrapper
fontWeight=
{
400
}
fontSize=
{
12
}
color=
"textPrimary"
{
...
props
}
/>
},
HeadlineSmall
(
props
:
TextProps
)
{
HeadlineSmall
(
props
:
TextProps
)
{
return
<
TextWrapper
fontWeight=
{
600
}
fontSize=
{
20
}
lineHeight=
"28px"
color=
"textPrimary"
{
...
props
}
/>
return
<
TextWrapper
fontWeight=
{
600
}
fontSize=
{
20
}
lineHeight=
"28px"
color=
"textPrimary"
{
...
props
}
/>
},
},
...
...
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