1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

UX Multichain: updated ui for settings page (#19167)

* updated ui for settings page

* lint fix

* resolved errors

* fixed search bar css

* fixed css

* lint fix

* fixed tests

* fixed indentation

* updated settings aria label
This commit is contained in:
Nidhi Kumari 2023-05-23 23:59:00 +05:30 committed by GitHub
parent 415798876c
commit 9db971768b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 123 additions and 145 deletions

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Suchergebnisse" "message": "Suchergebnisse"
}, },
"searchSettings": {
"message": "In Einstellungen suchen"
},
"searchTokens": { "searchTokens": {
"message": "Token suchen" "message": "Token suchen"
}, },

View File

@ -3047,12 +3047,6 @@
"searchAccounts": { "searchAccounts": {
"message": "Αναζήτηση Λογαριασμών" "message": "Αναζήτηση Λογαριασμών"
}, },
"searchResults": {
"message": "Αποτελέσματα Αναζήτησης"
},
"searchSettings": {
"message": "Αναζήτηση στις Ρυθμίσεις"
},
"searchTokens": { "searchTokens": {
"message": "Αναζήτηση Tokens" "message": "Αναζήτηση Tokens"
}, },

View File

@ -3522,9 +3522,6 @@
"searchResults": { "searchResults": {
"message": "Search results" "message": "Search results"
}, },
"searchSettings": {
"message": "Search in Settings"
},
"searchTokens": { "searchTokens": {
"message": "Search tokens" "message": "Search tokens"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Resultados de la búsqueda" "message": "Resultados de la búsqueda"
}, },
"searchSettings": {
"message": "Buscar en Configuración"
},
"searchTokens": { "searchTokens": {
"message": "Buscar tokens" "message": "Buscar tokens"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Résultats de la recherche" "message": "Résultats de la recherche"
}, },
"searchSettings": {
"message": "Rechercher dans les paramètres"
},
"searchTokens": { "searchTokens": {
"message": "Rechercher des jetons" "message": "Rechercher des jetons"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "खोज परिणाम" "message": "खोज परिणाम"
}, },
"searchSettings": {
"message": "सेटिंग्स में खोजें"
},
"searchTokens": { "searchTokens": {
"message": "टोकन खोजें" "message": "टोकन खोजें"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Cari hasil" "message": "Cari hasil"
}, },
"searchSettings": {
"message": "Cari di Pengaturan"
},
"searchTokens": { "searchTokens": {
"message": "Cari token" "message": "Cari token"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "検索結果" "message": "検索結果"
}, },
"searchSettings": {
"message": "設定で検索"
},
"searchTokens": { "searchTokens": {
"message": "トークンを検索" "message": "トークンを検索"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "검색 결과" "message": "검색 결과"
}, },
"searchSettings": {
"message": "설정에서 찾기"
},
"searchTokens": { "searchTokens": {
"message": "토큰 검색" "message": "토큰 검색"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Resultados da busca" "message": "Resultados da busca"
}, },
"searchSettings": {
"message": "Buscar nas configurações"
},
"searchTokens": { "searchTokens": {
"message": "Buscar tokens" "message": "Buscar tokens"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Результаты поиска" "message": "Результаты поиска"
}, },
"searchSettings": {
"message": "Поиск в настройках"
},
"searchTokens": { "searchTokens": {
"message": "Поиск токенов" "message": "Поиск токенов"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Mga Resulta ng Paghahanap" "message": "Mga Resulta ng Paghahanap"
}, },
"searchSettings": {
"message": "Maghanap sa mga Setting"
},
"searchTokens": { "searchTokens": {
"message": "Maghanap ng Mga Token" "message": "Maghanap ng Mga Token"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Arama sonuçları" "message": "Arama sonuçları"
}, },
"searchSettings": {
"message": "Ayarlarda ara"
},
"searchTokens": { "searchTokens": {
"message": "Token ara" "message": "Token ara"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "Kết quả tìm kiếm" "message": "Kết quả tìm kiếm"
}, },
"searchSettings": {
"message": "Tìm kiếm trong phần Cài đặt"
},
"searchTokens": { "searchTokens": {
"message": "Tìm kiếm token" "message": "Tìm kiếm token"
}, },

View File

@ -3050,9 +3050,6 @@
"searchResults": { "searchResults": {
"message": "搜索结果" "message": "搜索结果"
}, },
"searchSettings": {
"message": "在设置中搜索"
},
"searchTokens": { "searchTokens": {
"message": "搜索代币" "message": "搜索代币"
}, },

View File

@ -13,30 +13,26 @@
min-width: 0; min-width: 0;
flex: 0 0 auto; flex: 0 0 auto;
box-sizing: border-box; box-sizing: border-box;
opacity: 0.5;
transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out;
background-color: unset; background-color: unset;
text-align: start; text-align: start;
position: relative;
@include screen-sm-min {
&:hover {
opacity: 0.4;
}
&:active {
opacity: 0.6;
}
}
@include screen-sm-max { @include screen-sm-max {
@include H4; @include H4;
border-bottom: 1px solid var(--color-border-muted);
opacity: 1; opacity: 1;
} }
&__selected-indicator {
width: 4px;
height: calc(100% - 8px);
position: absolute;
top: 4px;
left: 4px;
}
&__content { &__content {
padding: 12px 18px;
display: flex; display: flex;
align-items: center; align-items: center;
position: relative; position: relative;
@ -67,7 +63,6 @@
justify-content: center; justify-content: center;
margin-inline-end: 16px; margin-inline-end: 16px;
flex: 0 0 18px; flex: 0 0 18px;
color: var(--color-icon-alternative);
} }
} }
@ -87,6 +82,10 @@
&--active { &--active {
opacity: 1 !important; opacity: 1 !important;
@include screen-sm-min {
background-color: var(--color-primary-muted);
}
} }
} }

View File

@ -3,6 +3,12 @@ import PropTypes from 'prop-types';
import classnames from 'classnames'; import classnames from 'classnames';
import { Icon, IconName, IconSize } from '../../component-library'; import { Icon, IconName, IconSize } from '../../component-library';
import Box from '../../ui/box';
import {
BorderRadius,
Color,
DISPLAY,
} from '../../../helpers/constants/design-system';
const TabBar = (props) => { const TabBar = (props) => {
const { tabs = [], onSelect, isActive } = props; const { tabs = [], onSelect, isActive } = props;
@ -10,13 +16,26 @@ const TabBar = (props) => {
return ( return (
<div className="tab-bar"> <div className="tab-bar">
{tabs.map(({ key, content, icon }) => ( {tabs.map(({ key, content, icon }) => (
<button <Box
as="button"
key={key} key={key}
paddingTop={5}
paddingBottom={5}
paddingLeft={4}
paddingRight={4}
className={classnames('tab-bar__tab pointer', { className={classnames('tab-bar__tab pointer', {
'tab-bar__tab--active': isActive(key, content), 'tab-bar__tab--active': isActive(key, content),
})} })}
onClick={() => onSelect(key)} onClick={() => onSelect(key)}
> >
{isActive(key, content) && (
<Box
className="tab-bar__tab__selected-indicator"
borderRadius={BorderRadius.pill}
backgroundColor={Color.primaryDefault}
display={[DISPLAY.NONE, DISPLAY.BLOCK]}
/>
)}
<div className="tab-bar__tab__content"> <div className="tab-bar__tab__content">
<div className="tab-bar__tab__content__icon">{icon}</div> <div className="tab-bar__tab__content__icon">{icon}</div>
<div className="tab-bar__tab__content__title">{content}</div> <div className="tab-bar__tab__content__title">{content}</div>
@ -26,7 +45,7 @@ const TabBar = (props) => {
size={IconSize.Sm} size={IconSize.Sm}
className="tab-bar__tab__caret" className="tab-bar__tab__caret"
/> />
</button> </Box>
))} ))}
</div> </div>
); );

View File

@ -23,34 +23,42 @@
} }
&__header { &__header {
padding: 8px 24px 8px 24px; padding: 20px 16px 20px 16px;
position: relative;
@include screen-sm-max {
background: var(--color-background-alternative);
}
&__title-container { &__title-container {
display: flex; display: grid;
flex-flow: row nowrap;
align-items: center; align-items: center;
flex: 0 0 auto; grid-template-columns: 197px 1fr 1fr;
&__close-button { @include screen-sm-max {
margin-left: auto; grid-template-rows: 1fr 1fr;
} grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
grid-template-areas:
'back title close'
'search search search';
&__close-button::after { &__back-button {
content: '\00D7'; grid-area: back;
font-size: 40px;
color: var(--color-icon-default);
cursor: pointer;
} }
&__title { &__title {
@include H3; grid-area: title;
}
flex: 1 0 auto; &__close-button {
grid-area: close;
}
&__search {
grid-area: search;
}
}
&__title {
@include screen-sm-min {
width: 197px;
}
@include screen-sm-max { @include screen-sm-max {
text-overflow: ellipsis; text-overflow: ellipsis;
@ -62,20 +70,7 @@
} }
&__search { &__search {
@include screen-sm-max { width: 330px;
position: relative;
}
@include screen-sm-min {
position: absolute;
right: 57px;
top: 10px;
width: 300px;
}
@include screen-md-min {
width: 400px;
}
&__list { &__list {
background: var(--color-background-default); background: var(--color-background-default);
@ -83,7 +78,7 @@
box-shadow: var(--shadow-size-sm) var(--color-shadow-default); box-shadow: var(--shadow-size-sm) var(--color-shadow-default);
border-radius: 6px; border-radius: 6px;
position: absolute; position: absolute;
width: 100%; width: 330px;
z-index: 10; z-index: 10;
> div { > div {
@ -144,16 +139,6 @@
&__subheader, &__subheader,
&__subheader--link { &__subheader--link {
@include H4;
padding: 16px 4px;
border-bottom: 1px solid var(--color-border-muted);
margin-right: 24px;
height: 72px;
align-items: center;
display: flex;
flex-flow: row nowrap;
@include screen-sm-max { @include screen-sm-max {
display: none; display: none;
} }
@ -225,11 +210,11 @@
} }
&__content { &__content {
margin-top: 8px;
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
border-top: 1px solid var(--color-border-muted);
&__tabs { &__tabs {
display: flex; display: flex;
@ -239,7 +224,6 @@
@include screen-sm-min { @include screen-sm-min {
flex: 0 0 40%; flex: 0 0 40%;
max-width: 197px; max-width: 197px;
padding-top: 13px;
} }
.tab-bar__tab { .tab-bar__tab {
@ -380,7 +364,8 @@
width: 100%; width: 100%;
} }
.eth-sign-toggle .toggle-button__status { // for eth_sign we need to override the uppercase property of toggle button text .eth-sign-toggle .toggle-button__status {
// for eth_sign we need to override the uppercase property of toggle button text
text-transform: capitalize; text-transform: capitalize;
} }
} }

View File

@ -95,7 +95,7 @@ export default function SettingsSearch({
return ( return (
<TextField <TextField
id="search-settings" id="search-settings"
placeholder={t('searchSettings')} placeholder={t('search')}
type="text" type="text"
value={searchQuery} value={searchQuery}
onChange={(e) => handleSearch(e.target.value)} onChange={(e) => handleSearch(e.target.value)}

View File

@ -27,8 +27,20 @@ import {
import { getSettingsRoutes } from '../../helpers/utils/settings-search'; import { getSettingsRoutes } from '../../helpers/utils/settings-search';
import AddNetwork from '../../components/app/add-network/add-network'; import AddNetwork from '../../components/app/add-network/add-network';
import { ButtonIcon, Icon, IconName } from '../../components/component-library'; import {
import { Color, DISPLAY } from '../../helpers/constants/design-system'; ButtonIcon,
Icon,
IconName,
Text,
} from '../../components/component-library';
import {
AlignItems,
Color,
DISPLAY,
FLEX_DIRECTION,
TextVariant,
} from '../../helpers/constants/design-system';
import Box from '../../components/ui/box';
import SettingsTab from './settings-tab'; import SettingsTab from './settings-tab';
import AlertsTab from './alerts-tab'; import AlertsTab from './alerts-tab';
import NetworksTab from './networks-tab'; import NetworksTab from './networks-tab';
@ -122,27 +134,17 @@ class SettingsPage extends PureComponent {
<ButtonIcon <ButtonIcon
ariaLabel={t('back')} ariaLabel={t('back')}
iconName={IconName.ArrowLeft} iconName={IconName.ArrowLeft}
className="settings-page__back-button" className="settings-page__header__title-container__back-button"
color={Color.iconDefault} color={Color.iconDefault}
onClick={() => history.push(backRoute)} onClick={() => history.push(backRoute)}
display={[DISPLAY.FLEX, DISPLAY.NONE]} display={[DISPLAY.FLEX, DISPLAY.NONE]}
/> />
)} )}
{this.renderTitle()} {this.renderTitle()}
<div <Box
className="settings-page__header__title-container__close-button" className="settings-page__header__title-container__search"
onClick={() => { display={[DISPLAY.BLOCK]}
if (addNewNetwork) { >
history.push(NETWORKS_ROUTE);
} else {
history.push(mostRecentOverviewPage);
}
}}
/>
</div>
<div className="settings-page__header__search">
<SettingsSearch <SettingsSearch
onSearch={({ searchQuery = '', results = [] }) => { onSearch={({ searchQuery = '', results = [] }) => {
this.setState({ this.setState({
@ -159,6 +161,20 @@ class SettingsPage extends PureComponent {
onClickSetting={(setting) => this.handleClickSetting(setting)} onClickSetting={(setting) => this.handleClickSetting(setting)}
/> />
)} )}
</Box>
<ButtonIcon
className="settings-page__header__title-container__close-button"
iconName={IconName.Close}
ariaLabel={t('close')}
onClick={() => {
if (addNewNetwork) {
history.push(NETWORKS_ROUTE);
} else {
history.push(mostRecentOverviewPage);
}
}}
marginLeft="auto"
/>
</div> </div>
</div> </div>
@ -192,7 +208,7 @@ class SettingsPage extends PureComponent {
return ( return (
<div className="settings-page__header__title-container__title"> <div className="settings-page__header__title-container__title">
{titleText} <Text variant={TextVariant.headingMd}>{titleText}</Text>
</div> </div>
); );
} }
@ -225,17 +241,24 @@ class SettingsPage extends PureComponent {
return ( return (
!currentPath.startsWith(NETWORKS_ROUTE) && ( !currentPath.startsWith(NETWORKS_ROUTE) && (
<div className="settings-page__subheader"> <Box
<div className="settings-page__subheader"
padding={4}
display={DISPLAY.FLEX}
flexDirection={FLEX_DIRECTION.ROW}
alignItems={AlignItems.center}
>
<Text
className={classnames({ className={classnames({
'settings-page__subheader--link': initialBreadCrumbRoute, 'settings-page__subheader--link': initialBreadCrumbRoute,
})} })}
variant={TextVariant.headingSm}
onClick={() => onClick={() =>
initialBreadCrumbRoute && history.push(initialBreadCrumbRoute) initialBreadCrumbRoute && history.push(initialBreadCrumbRoute)
} }
> >
{subheaderText} {subheaderText}
</div> </Text>
{breadCrumbTextKey && ( {breadCrumbTextKey && (
<div className="settings-page__subheader--break"> <div className="settings-page__subheader--break">
<span>{' > '}</span> <span>{' > '}</span>
@ -248,7 +271,7 @@ class SettingsPage extends PureComponent {
{addressName} {addressName}
</div> </div>
)} )}
</div> </Box>
) )
); );
} }
@ -293,12 +316,12 @@ class SettingsPage extends PureComponent {
}, },
{ {
content: t('networks'), content: t('networks'),
icon: <i className="fa fa-plug" />, icon: <Icon name={IconName.Plug} />,
key: NETWORKS_ROUTE, key: NETWORKS_ROUTE,
}, },
{ {
content: t('experimental'), content: t('experimental'),
icon: <i className="fa fa-flask" />, icon: <Icon name={IconName.Flask} />,
key: EXPERIMENTAL_ROUTE, key: EXPERIMENTAL_ROUTE,
}, },
{ {

View File

@ -40,6 +40,6 @@ describe('SettingsPage', () => {
'/settings', '/settings',
); );
expect(queryByPlaceholderText('Search in Settings')).toBeInTheDocument(); expect(queryByPlaceholderText('Search')).toBeInTheDocument();
}); });
}); });