-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12200 from brave/network-icon-select-network-button
feat(wallet): Network Icon in Select Network Button
- Loading branch information
Showing
9 changed files
with
94 additions
and
104 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
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
39 changes: 39 additions & 0 deletions
39
components/brave_wallet_ui/components/shared/select-network-button/index.tsx
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,39 @@ | ||
import * as React from 'react' | ||
|
||
// Types | ||
import { BraveWallet } from '../../../constants/types' | ||
|
||
// Utils | ||
import { reduceNetworkDisplayName } from '../../../utils/network-utils' | ||
|
||
// Components | ||
import { CreateNetworkIcon } from '../' | ||
|
||
// Styled Components | ||
import { | ||
OvalButton, | ||
OvalButtonText, | ||
CaratDownIcon | ||
} from './style' | ||
|
||
export interface Props { | ||
onClick: () => void | ||
selectedNetwork: BraveWallet.EthereumChain | ||
isPanel?: boolean | ||
} | ||
|
||
const SelectNetworkButton = (props: Props) => { | ||
const { | ||
onClick, | ||
selectedNetwork, | ||
isPanel | ||
} = props | ||
return ( | ||
<OvalButton isPanel={isPanel} onClick={onClick}> | ||
<CreateNetworkIcon network={selectedNetwork} marginRight={4} /> | ||
<OvalButtonText isPanel={isPanel}>{reduceNetworkDisplayName(selectedNetwork.chainName)}</OvalButtonText> | ||
<CaratDownIcon isPanel={isPanel} /> | ||
</OvalButton> | ||
) | ||
} | ||
export default SelectNetworkButton |
35 changes: 35 additions & 0 deletions
35
components/brave_wallet_ui/components/shared/select-network-button/style.ts
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,35 @@ | ||
import styled from 'styled-components' | ||
import { CaratCircleODownIcon } from 'brave-ui/components/icons' | ||
import { WalletButton } from '../../shared/style' | ||
|
||
interface StyleProps { | ||
isPanel?: boolean | ||
} | ||
|
||
export const CaratDownIcon = styled(CaratCircleODownIcon) <StyleProps>` | ||
width: 14px; | ||
height: 14px; | ||
margin-left: 4px; | ||
color: ${(p) => p.isPanel ? p.theme.palette.white : p.theme.color.interactive07}; | ||
` | ||
|
||
export const OvalButton = styled(WalletButton) <StyleProps>` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
outline: none; | ||
background: none; | ||
border-radius: 48px; | ||
padding: 3px 10px; | ||
border: 1px solid ${(p) => p.isPanel ? 'rgba(255,255,255,0.5)' : p.theme.color.interactive08}; | ||
` | ||
|
||
export const OvalButtonText = styled.span<StyleProps>` | ||
font-family: Poppins; | ||
font-size: 12px; | ||
line-height: 18px; | ||
letter-spacing: 0.01em; | ||
color: ${(p) => p.isPanel ? p.theme.palette.white : p.theme.color.text02}; | ||
font-weight: 600; | ||
` |