From 88862249cec73710eb1f88d505d8cc718ccdbdfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Tue, 17 Apr 2018 18:04:15 +0200 Subject: [PATCH] Use react-router for switch tab in SettingsPage --- src/components/SelectAccount/index.js | 3 +- src/components/SelectCurrency/index.js | 60 ++++++++++++++ src/components/SelectCurrency/stories.js | 31 +++++++ .../SettingsPage/SettingsSection.js | 31 ++++++- src/components/SettingsPage/index.js | 82 +++++++++++-------- .../SettingsPage/sections/Currencies.js | 21 ++++- src/components/SideBar/Item.js | 10 ++- src/components/TopBar.js | 10 ++- src/components/base/Button/index.js | 19 +++-- src/components/base/CheckBox/index.js | 1 - src/components/layout/Default.js | 1 + static/i18n/en/common.yml | 1 + 12 files changed, 217 insertions(+), 53 deletions(-) create mode 100644 src/components/SelectCurrency/index.js create mode 100644 src/components/SelectCurrency/stories.js diff --git a/src/components/SelectAccount/index.js b/src/components/SelectAccount/index.js index c08ac6bc..823de202 100644 --- a/src/components/SelectAccount/index.js +++ b/src/components/SelectAccount/index.js @@ -3,9 +3,10 @@ import React from 'react' import { connect } from 'react-redux' import { translate } from 'react-i18next' -import noop from 'lodash/noop' import { getIconByCoinType } from '@ledgerhq/currencies/react' +import noop from 'lodash/noop' + import type { Account } from '@ledgerhq/wallet-common/lib/types' import type { T } from 'types/common' diff --git a/src/components/SelectCurrency/index.js b/src/components/SelectCurrency/index.js new file mode 100644 index 00000000..298a90e9 --- /dev/null +++ b/src/components/SelectCurrency/index.js @@ -0,0 +1,60 @@ +// @flow + +import React from 'react' +import { translate } from 'react-i18next' +import { getIconByCoinType } from '@ledgerhq/currencies/react' +import { listCurrencies } from '@ledgerhq/currencies' + +import noop from 'lodash/noop' + +import type { Currency } from '@ledgerhq/currencies' +import type { T } from 'types/common' + +import Select from 'components/base/Select' +import Box from 'components/base/Box' + +const renderItem = a => { + const { color, name, coinType } = a + const Icon = getIconByCoinType(coinType) + return ( + + {Icon && ( + + + + )} + + {name} + + + ) +} + +const currencies = listCurrencies() + +type Props = { + onChange: Function, + value?: Currency, + t: T, +} + +const SelectCurrency = ({ onChange, value, t, ...props }: Props) => ( +