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
c563dd5a
Unverified
Commit
c563dd5a
authored
Nov 14, 2022
by
Charles Bachmeier
Committed by
GitHub
Nov 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add market logos to filters and chips (#5199)
* add market logos to filters and chips * remove comment
parent
bd8cd714
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
CollectionNfts.tsx
src/nft/components/collection/CollectionNfts.tsx
+11
-2
MarketplaceSelect.tsx
src/nft/components/collection/MarketplaceSelect.tsx
+26
-2
TraitChip.tsx
src/nft/components/collection/TraitChip.tsx
+1
-1
No files found.
src/nft/components/collection/CollectionNfts.tsx
View file @
c563dd5a
...
@@ -45,7 +45,7 @@ import styled from 'styled-components/macro'
...
@@ -45,7 +45,7 @@ import styled from 'styled-components/macro'
import
{
ThemedText
}
from
'
theme
'
import
{
ThemedText
}
from
'
theme
'
import
{
CollectionAssetLoading
}
from
'
./CollectionAssetLoading
'
import
{
CollectionAssetLoading
}
from
'
./CollectionAssetLoading
'
import
{
MARKETPLACE_ITEMS
}
from
'
./MarketplaceSelect
'
import
{
MARKETPLACE_ITEMS
,
MarketplaceLogo
}
from
'
./MarketplaceSelect
'
import
{
Sweep
,
useSweepFetcherParams
}
from
'
./Sweep
'
import
{
Sweep
,
useSweepFetcherParams
}
from
'
./Sweep
'
import
{
TraitChip
}
from
'
./TraitChip
'
import
{
TraitChip
}
from
'
./TraitChip
'
...
@@ -166,6 +166,10 @@ export const LoadingButton = styled.div`
...
@@ -166,6 +166,10 @@ export const LoadingButton = styled.div`
background-size: 400%;
background-size: 400%;
`
`
const
MarketNameWrapper
=
styled
(
Row
)
`
gap: 8px;
`
const
loadingAssets
=
(
height
?:
number
)
=>
(
const
loadingAssets
=
(
height
?:
number
)
=>
(
<>
<>
{
Array
.
from
(
Array
(
ASSET_PAGE_SIZE
),
(
_
,
index
)
=>
(
{
Array
.
from
(
Array
(
ASSET_PAGE_SIZE
),
(
_
,
index
)
=>
(
...
@@ -459,7 +463,12 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
...
@@ -459,7 +463,12 @@ export const CollectionNfts = ({ contractAddress, collectionStats, rarityVerifie
{
markets
.
map
((
market
)
=>
(
{
markets
.
map
((
market
)
=>
(
<
TraitChip
<
TraitChip
key=
{
market
}
key=
{
market
}
value=
{
MARKETPLACE_ITEMS
[
market
as
keyof
typeof
MARKETPLACE_ITEMS
]
}
value=
{
<
MarketNameWrapper
>
<
MarketplaceLogo
src=
{
`/nft/svgs/marketplaces/${market.toLowerCase()}.svg`
}
/>
{
MARKETPLACE_ITEMS
[
market
as
keyof
typeof
MARKETPLACE_ITEMS
]
}
</
MarketNameWrapper
>
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
scrollToTop
()
scrollToTop
()
removeMarket
(
market
)
removeMarket
(
market
)
...
...
src/nft/components/collection/MarketplaceSelect.tsx
View file @
c563dd5a
...
@@ -24,6 +24,16 @@ const FilterItemWrapper = styled(Row)`
...
@@ -24,6 +24,16 @@ const FilterItemWrapper = styled(Row)`
}
}
`
`
export
const
MarketplaceLogo
=
styled
.
img
`
height: 16px;
width: 16px;
border-radius: 4px;
`
const
MarketNameWrapper
=
styled
(
Row
)
`
gap: 10px;
`
export
const
MARKETPLACE_ITEMS
=
{
export
const
MARKETPLACE_ITEMS
=
{
looksrare
:
'
LooksRare
'
,
looksrare
:
'
LooksRare
'
,
nft20
:
'
NFT20
'
,
nft20
:
'
NFT20
'
,
...
@@ -34,12 +44,19 @@ export const MARKETPLACE_ITEMS = {
...
@@ -34,12 +44,19 @@ export const MARKETPLACE_ITEMS = {
sudoswap
:
'
SudoSwap
'
,
sudoswap
:
'
SudoSwap
'
,
}
}
function
getMarketLogoSrc
(
market
:
string
)
{
const
marketplaceItem
=
Object
.
keys
(
MARKETPLACE_ITEMS
).
find
(
(
key
)
=>
MARKETPLACE_ITEMS
[
key
as
keyof
typeof
MARKETPLACE_ITEMS
]
===
market
)
return
`/nft/svgs/marketplaces/
${
marketplaceItem
}
.svg`
}
export
const
FilterItem
=
({
export
const
FilterItem
=
({
title
,
title
,
element
,
element
,
onClick
,
onClick
,
}:
{
}:
{
title
:
string
title
:
string
|
JSX
.
Element
element
:
JSX
.
Element
element
:
JSX
.
Element
onClick
:
React
.
MouseEventHandler
<
HTMLElement
>
onClick
:
React
.
MouseEventHandler
<
HTMLElement
>
})
=>
{
})
=>
{
...
@@ -91,9 +108,16 @@ const MarketplaceItem = ({
...
@@ -91,9 +108,16 @@ const MarketplaceItem = ({
</
Checkbox
>
</
Checkbox
>
)
)
const
titleWithLogo
=
(
<
MarketNameWrapper
>
<
MarketplaceLogo
src=
{
getMarketLogoSrc
(
title
)
}
/>
{
title
}
</
MarketNameWrapper
>
)
return
(
return
(
<
div
key=
{
value
}
onMouseEnter=
{
toggleHover
}
onMouseLeave=
{
toggleHover
}
>
<
div
key=
{
value
}
onMouseEnter=
{
toggleHover
}
onMouseLeave=
{
toggleHover
}
>
<
FilterItem
title=
{
title
}
element=
{
checkbox
}
onClick=
{
handleCheckbox
}
/>
<
FilterItem
title=
{
title
WithLogo
}
element=
{
checkbox
}
onClick=
{
handleCheckbox
}
/>
</
div
>
</
div
>
)
)
}
}
...
...
src/nft/components/collection/TraitChip.tsx
View file @
c563dd5a
...
@@ -20,7 +20,7 @@ const CrossIconWrap = styled.div`
...
@@ -20,7 +20,7 @@ const CrossIconWrap = styled.div`
padding-top: 1px;
padding-top: 1px;
`
`
export
const
TraitChip
=
({
onClick
,
value
}:
{
value
:
string
;
onClick
:
()
=>
void
})
=>
{
export
const
TraitChip
=
({
onClick
,
value
}:
{
value
:
string
|
JSX
.
Element
;
onClick
:
()
=>
void
})
=>
{
return
(
return
(
<
TraitChipWrap
>
<
TraitChipWrap
>
<
span
>
{
value
}
</
span
>
<
span
>
{
value
}
</
span
>
...
...
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