-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
447 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import classNames from 'classnames' | ||
import { ComponentProps, FC } from 'react' | ||
import { ComponentProps, FC, ReactNode } from 'react' | ||
import styles from './index.module.scss' | ||
|
||
export const FilterSortContainerOnMobile: FC<ComponentProps<'div'>> = ({ children, ...elProps }) => { | ||
const items = Array.from(children as Iterable<ReactNode>).map((child, index) => ({ | ||
child, | ||
key: `${elProps.key}${index}`, | ||
})) | ||
return ( | ||
<div {...elProps} className={classNames(styles.filterSortContainerOnMobile, elProps.className)}> | ||
{children} | ||
<ul> | ||
{items.map(({ child, key }) => ( | ||
<li key={key}>{child}</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import classNames from 'classnames' | ||
import { useTranslation } from 'react-i18next' | ||
import { useHistory } from 'react-router-dom' | ||
import styles from './styles.module.scss' | ||
|
||
export const whiteList = ['invalid', 'suspicious', 'out-of-length-range', 'rgb++', 'layer-1-asset', 'layer-2-asset'] | ||
|
||
const NFTTag = ({ tagName, to }: { tagName: string; to?: string }) => { | ||
const { t } = useTranslation() | ||
const { push } = useHistory() | ||
|
||
let tag = tagName | ||
let content = t(`xudt.tags.${tag}`) | ||
if (tag.startsWith('verified-on-')) { | ||
// FIXME: should be i18n | ||
content = content.replace('Platform', tag.replace('verified-on-', '')) | ||
tag = 'verified-on' | ||
} | ||
const handleClick = () => { | ||
const search = new URLSearchParams(window.location.search) | ||
const tags = search.get('tags')?.split(',') ?? [] | ||
if (tags.includes(tag)) { | ||
const newTags = tags.filter(t => t !== tag) | ||
if (newTags.length) { | ||
search.set('tags', newTags.join(',')) | ||
} else { | ||
search.delete('tags') | ||
} | ||
} else { | ||
search.set('tags', [...tags, tag].join(',')) | ||
} | ||
push(`${to ?? window.location.pathname}?${search}`) | ||
} | ||
|
||
return whiteList.includes(tagName) ? ( | ||
<button | ||
type="button" | ||
className={classNames(styles.container, styles.normal)} | ||
data-type={tagName} | ||
onClick={handleClick} | ||
> | ||
{content} | ||
</button> | ||
) : null | ||
} | ||
|
||
export default NFTTag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
.container { | ||
appearance: none; | ||
font-size: 0.75rem; | ||
line-height: 1; | ||
border-radius: 4px; | ||
display: flex; | ||
padding: 4px; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 4px; | ||
white-space: nowrap; | ||
outline: none; | ||
cursor: pointer; | ||
|
||
&[data-type='supply-limited'] { | ||
border-color: #fcdeb0; | ||
background: #fdf5d7; | ||
|
||
span { | ||
color: #caac0f; | ||
} | ||
} | ||
|
||
&[data-type='out-of-length-range'] { | ||
border-color: #b0cbfc; | ||
background: #d7e5fd; | ||
color: #346dff; | ||
} | ||
|
||
&[data-type='invalid'] { | ||
border-color: #ccc; | ||
background: #f0f0f0; | ||
color: #666; | ||
} | ||
|
||
&[data-type='duplicate'] { | ||
border-color: #ffdba6; | ||
background: #fffcf2; | ||
color: #ffa800; | ||
} | ||
|
||
&[data-type='layer-1-asset'] { | ||
border-color: var(--btc-primary-dimmed-color); | ||
background: var(--btc-secondary-color); | ||
color: var(--btc-primary-color); | ||
} | ||
|
||
&[data-type='layer-2-asset'] { | ||
border-color: var(--primary-dimmed-color); | ||
background: var(--secondary-color); | ||
color: var(--primary-color); | ||
} | ||
|
||
&[data-type='verified-on-platform'] { | ||
border-color: #99e6ca; | ||
background: #d7fdf2; | ||
color: #00bb8e; | ||
} | ||
|
||
&[data-type='supply-unlimited'] { | ||
border-color: #b0e1fc; | ||
background: #d2f7ff; | ||
color: #00a7cc; | ||
} | ||
|
||
&[data-type='rgb++'] { | ||
border: none; | ||
background: linear-gradient(90deg, #ffd176 0.23%, #ffdb81 6.7%, #84ffcb 99.82%); | ||
color: #333; | ||
} | ||
|
||
&[data-type='suspicious'] { | ||
background: #ffe8e8; | ||
border-color: #ff9c9c; | ||
color: #fa504f; | ||
} | ||
|
||
span { | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: normal; | ||
} | ||
} | ||
|
||
.normal { | ||
border: 1px solid; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.