Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add BNB Chain placeholder to token explore network menu #6198

Merged
merged 2 commits into from
Mar 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/components/Tokens/TokenTable/NetworkFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Badge from 'components/Badge'
import { getChainInfo } from 'constants/chainInfo'
import { BACKEND_CHAIN_NAMES, CHAIN_NAME_TO_CHAIN_ID, validateUrlChainParam } from 'graphql/data/util'
import { useOnClickOutside } from 'hooks/useOnClickOutside'
Expand All @@ -6,7 +7,7 @@ import { Check, ChevronDown, ChevronUp } from 'react-feather'
import { useNavigate, useParams } from 'react-router-dom'
import { useModalIsOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer'
import styled, { useTheme } from 'styled-components/macro'
import styled, { css, useTheme } from 'styled-components/macro'

import FilterOption from './FilterOption'

Expand All @@ -20,7 +21,7 @@ const InternalMenuItem = styled.div`
text-decoration: none;
}
`
const InternalLinkMenuItem = styled(InternalMenuItem)`
const InternalLinkMenuItem = styled(InternalMenuItem)<{ disabled?: boolean }>`
display: flex;
align-items: center;
justify-content: space-between;
Expand All @@ -32,6 +33,13 @@ const InternalLinkMenuItem = styled(InternalMenuItem)`
background-color: ${({ theme }) => theme.hoverState};
text-decoration: none;
}

${({ disabled }) =>
disabled &&
css`
opacity: 60%;
pointer-events: none;
`}
`
const MenuTimeFlyout = styled.span`
min-width: 240px;
Expand Down Expand Up @@ -87,6 +95,12 @@ const CheckContainer = styled.div`
const NetworkFilterOption = styled(FilterOption)`
width: 156px;
`
const Tag = styled(Badge)`
background-color: ${({ theme }) => theme.backgroundModule};
color: ${({ theme }) => theme.textSecondary};
font-size: 10px;
padding: 4px 6px;
`

export default function NetworkFilter() {
const theme = useTheme()
Expand All @@ -100,6 +114,7 @@ export default function NetworkFilter() {
const currentChainName = validateUrlChainParam(chainName)

const chainInfo = getChainInfo(CHAIN_NAME_TO_CHAIN_ID[currentChainName])
const BNBChainInfo = getChainInfo(CHAIN_NAME_TO_CHAIN_ID.BNB)

return (
<StyledMenu ref={node}>
Expand Down Expand Up @@ -148,6 +163,13 @@ export default function NetworkFilter() {
</InternalLinkMenuItem>
)
})}
<InternalLinkMenuItem data-testid="tokens-network-filter-option-bnb-chain" disabled>
<NetworkLabel>
<Logo src={BNBChainInfo.logoUrl} />
{BNBChainInfo.label}
</NetworkLabel>
<Tag>Coming soon</Tag>
</InternalLinkMenuItem>
</MenuTimeFlyout>
)}
</StyledMenu>
Expand Down