1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

Fix connected sites modal styling; add shortenUrl function (#8409)

* fix content row styling

* fix border styling

* handle long domain names
This commit is contained in:
Erik Marks 2020-04-27 08:36:08 -07:00 committed by GitHub
parent b2d6076da3
commit 40cd976e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -3,7 +3,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
border-top: 1px solid #D2D8DD;
} }
&__content-row { &__content-row {
@ -12,7 +11,7 @@
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-bottom: 1px solid #D2D8DD; border-top: 1px solid #D2D8DD;
padding: 16px 24px; padding: 16px 24px;
} }
@ -25,8 +24,10 @@
} }
&__domain-name { &__domain-name {
max-width: 215px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
direction: rtl;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-left: 6px; margin-left: 6px;
} }

View File

@ -77,7 +77,7 @@
} }
&-content { &-content {
overflow-y: scroll; overflow-y: auto;
position: relative; position: relative;
display: flex; display: flex;
flex: 1; flex: 1;

View File

@ -132,7 +132,6 @@ export function formatBalance (balance, decimalsToKeep, needsParse = true, ticke
return formatted return formatted
} }
export function generateBalanceObject (formattedBalance, decimalsToKeep = 1) { export function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
let balance = formattedBalance.split(' ')[0] let balance = formattedBalance.split(' ')[0]
const label = formattedBalance.split(' ')[1] const label = formattedBalance.split(' ')[1]
@ -267,6 +266,17 @@ export function checksumAddress (address) {
return checksummed return checksummed
} }
/**
* Shortens an Ethereum address for display, preserving the beginning and end.
* Returns the given address if it is no longer than 10 characters.
* Shortened addresses are 13 characters long.
*
* Example output: 0xabcd...1234
*
* @param {string} address - The address to shorten.
* @returns {string} The shortened address, or the original if it was no longer
* than 10 characters.
*/
export function shortenAddress (address = '') { export function shortenAddress (address = '') {
if (address.length < 11) { if (address.length < 11) {
return address return address