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
85d1b901
Unverified
Commit
85d1b901
authored
May 12, 2023
by
Charles Bachmeier
Committed by
GitHub
May 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [DetailsV2] Mobile support for traits (#6535)
Co-authored-by:
Charles Bachmeier
<
charlie@genie.xyz
>
parent
38af86e1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
6 deletions
+51
-6
DataPageTraits.tsx
src/nft/components/details/detailsV2/DataPageTraits.tsx
+11
-3
TraitRow.tsx
src/nft/components/details/detailsV2/TraitRow.tsx
+7
-3
DataPageTraits.test.tsx.snap
...ails/detailsV2/__snapshots__/DataPageTraits.test.tsx.snap
+33
-0
No files found.
src/nft/components/details/detailsV2/DataPageTraits.tsx
View file @
85d1b901
...
@@ -6,7 +6,7 @@ import { useSubscribeScrollState } from 'nft/hooks'
...
@@ -6,7 +6,7 @@ import { useSubscribeScrollState } from 'nft/hooks'
import
{
GenieAsset
}
from
'
nft/types
'
import
{
GenieAsset
}
from
'
nft/types
'
import
{
useMemo
}
from
'
react
'
import
{
useMemo
}
from
'
react
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
opacify
}
from
'
theme/utils
'
import
{
opacify
}
from
'
theme/utils
'
import
{
Tab
,
TabbedComponent
}
from
'
./TabbedComponent
'
import
{
Tab
,
TabbedComponent
}
from
'
./TabbedComponent
'
...
@@ -16,12 +16,20 @@ const TraitsHeaderContainer = styled(Row)`
...
@@ -16,12 +16,20 @@ const TraitsHeaderContainer = styled(Row)`
padding-right: 12px;
padding-right: 12px;
`
`
const
TraitsHeader
=
styled
(
ThemedText
.
SubHeaderSmall
)
<
{
$flex
?:
number
;
$justifyContent
?:
string
}
>
`
const
TraitsHeader
=
styled
(
ThemedText
.
SubHeaderSmall
)
<
{
$flex
?:
number
$justifyContent
?:
string
hideOnSmall
?:
boolean
}
>
`
display: flex;
display: flex;
line-height: 20px;
line-height: 20px;
color:
${({
theme
})
=>
theme
.
textSecondary
}
;
color:
${({
theme
})
=>
theme
.
textSecondary
}
;
flex:
${({
$flex
})
=>
$flex
??
1
};
flex:
${({
$flex
})
=>
$flex
??
1
};
justify
-
content
:
$
{({
$justifyContent
})
=>
$justifyContent
};
justify
-
content
:
$
{({
$justifyContent
})
=>
$justifyContent
};
@
media
screen
and
(
max
-
width
:
$
{
BREAKPOINTS
.
sm
}
px) {
display:
${({
hideOnSmall
})
=>
(
hideOnSmall
?
'
none
'
:
'
flex
'
)}
;
}
`
`
const
TraitRowContainer
=
styled
.
div
`
const
TraitRowContainer
=
styled
.
div
`
...
@@ -76,7 +84,7 @@ const TraitsContent = ({ asset }: { asset: GenieAsset }) => {
...
@@ -76,7 +84,7 @@ const TraitsContent = ({ asset }: { asset: GenieAsset }) => {
<
TraitsHeader
$flex=
{
2
}
>
<
TraitsHeader
$flex=
{
2
}
>
<
Trans
>
Floor price
</
Trans
>
<
Trans
>
Floor price
</
Trans
>
</
TraitsHeader
>
</
TraitsHeader
>
<
TraitsHeader
>
<
TraitsHeader
hideOnSmall=
{
true
}
>
<
Trans
>
Quantity
</
Trans
>
<
Trans
>
Quantity
</
Trans
>
</
TraitsHeader
>
</
TraitsHeader
>
<
TraitsHeader
$flex=
{
1.5
}
$justifyContent=
"flex-end"
>
<
TraitsHeader
$flex=
{
1.5
}
$justifyContent=
"flex-end"
>
...
...
src/nft/components/details/detailsV2/TraitRow.tsx
View file @
85d1b901
...
@@ -5,7 +5,7 @@ import { formatEth } from 'nft/utils'
...
@@ -5,7 +5,7 @@ import { formatEth } from 'nft/utils'
import
qs
from
'
qs
'
import
qs
from
'
qs
'
import
{
Link
}
from
'
react-router-dom
'
import
{
Link
}
from
'
react-router-dom
'
import
styled
from
'
styled-components/macro
'
import
styled
from
'
styled-components/macro
'
import
{
ThemedText
}
from
'
theme
'
import
{
BREAKPOINTS
,
ThemedText
}
from
'
theme
'
import
{
getRarityLevel
,
RarityGraph
}
from
'
./RarityGraph
'
import
{
getRarityLevel
,
RarityGraph
}
from
'
./RarityGraph
'
...
@@ -43,12 +43,16 @@ const TraitColumnValue = styled(Column)<{ $flex?: number; $alignItems?: string }
...
@@ -43,12 +43,16 @@ const TraitColumnValue = styled(Column)<{ $flex?: number; $alignItems?: string }
align
-
items
:
$
{({
$alignItems
})
=>
$alignItems
};
align
-
items
:
$
{({
$alignItems
})
=>
$alignItems
};
`
`
const TraitRowValue = styled(ThemedText.BodySmall)<{ $flex?: number; $justifyContent?: string }>`
const TraitRowValue = styled(ThemedText.BodySmall)<{ $flex?: number; $justifyContent?: string
; hideOnSmall?: boolean
}>`
display
:
flex
;
display
:
flex
;
line
-
height
:
20
px
;
line
-
height
:
20
px
;
padding
-
top
:
20
px
;
padding
-
top
:
20
px
;
flex
:
$
{({
$flex
})
=>
$flex
??
1
};
flex
:
$
{({
$flex
})
=>
$flex
??
1
};
justify
-
content
:
$
{({
$justifyContent
})
=>
$justifyContent
};
justify
-
content
:
$
{({
$justifyContent
})
=>
$justifyContent
};
@
media
screen
and
(
max
-
width
:
$
{
BREAKPOINTS
.
sm
}
px) {
display:
${({
hideOnSmall
})
=>
(
hideOnSmall
?
'
none
'
:
'
flex
'
)}
;
}
`
`
export
const
TraitRow
=
({
trait
,
collectionAddress
}:
{
trait
:
Trait
;
collectionAddress
:
string
})
=>
{
export
const
TraitRow
=
({
trait
,
collectionAddress
}:
{
trait
:
Trait
;
collectionAddress
:
string
})
=>
{
...
@@ -70,7 +74,7 @@ export const TraitRow = ({ trait, collectionAddress }: { trait: Trait; collectio
...
@@ -70,7 +74,7 @@ export const TraitRow = ({ trait, collectionAddress }: { trait: Trait; collectio
<
ThemedText
.
BodyPrimary
lineHeight=
"20px"
>
{
trait
.
trait_value
}
</
ThemedText
.
BodyPrimary
>
<
ThemedText
.
BodyPrimary
lineHeight=
"20px"
>
{
trait
.
trait_value
}
</
ThemedText
.
BodyPrimary
>
</
TraitColumnValue
>
</
TraitColumnValue
>
<
TraitRowValue
$flex=
{
2
}
>
{
formatEth
(
randomRarity
*
1000
)
}
ETH
</
TraitRowValue
>
<
TraitRowValue
$flex=
{
2
}
>
{
formatEth
(
randomRarity
*
1000
)
}
ETH
</
TraitRowValue
>
<TraitRowValue>{Math.round(randomRarity * 10000)}</TraitRowValue>
<
TraitRowValue
hideOnSmall=
{
true
}
>
{
Math
.
round
(
randomRarity
*
10000
)
}
</
TraitRowValue
>
<
TraitColumnValue
$flex=
{
1.5
}
$alignItems=
"flex-end"
>
<
TraitColumnValue
$flex=
{
1.5
}
$alignItems=
"flex-end"
>
<
SubheaderTinyHidden
$color=
{
rarityLevel
.
color
}
>
{
rarityLevel
.
caption
}
</
SubheaderTinyHidden
>
<
SubheaderTinyHidden
$color=
{
rarityLevel
.
color
}
>
{
rarityLevel
.
caption
}
</
SubheaderTinyHidden
>
<
RarityGraph
trait=
{
trait
}
rarity=
{
randomRarity
}
/>
<
RarityGraph
trait=
{
trait
}
rarity=
{
randomRarity
}
/>
...
...
src/nft/components/details/detailsV2/__snapshots__/DataPageTraits.test.tsx.snap
View file @
85d1b901
...
@@ -174,6 +174,39 @@ exports[`data page trait component does not load with asset with no traits 1`] =
...
@@ -174,6 +174,39 @@ exports[`data page trait component does not load with asset with no traits 1`] =
border-radius: 8px;
border-radius: 8px;
}
}
@media screen and (max-width:640px) {
.c10 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
@media screen and (max-width:640px) {
.c11 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
@media screen and (max-width:640px) {
.c12 {
display: none;
}
}
@media screen and (max-width:640px) {
.c13 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
}
<div
<div
class="c0"
class="c0"
>
>
...
...
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