From 6e691615a155caa826471ccf97f6fbf68a0b8626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Mon, 12 Feb 2018 17:47:20 +0100 Subject: [PATCH] Add SVG Icons --- src/components/DashboardPage/AccountCard.js | 7 ++++--- src/components/GlobalSearch.js | 5 +++-- src/components/SideBar/Item.js | 21 +++++++++++++++++---- src/components/SideBar/index.js | 21 ++++++++++++++------- src/components/TopBar.js | 8 +++++--- src/components/base/Chart/index.js | 2 +- src/icons/Activity.js | 10 ++++++++++ src/icons/ArrowDown.js | 13 +++++++++++++ src/icons/ArrowUp.js | 10 ++++++++++ src/icons/Devices.js | 10 ++++++++++ src/icons/PieChart.js | 10 ++++++++++ src/icons/Plus.js | 10 ++++++++++ src/icons/Search.js | 10 ++++++++++ src/icons/Settings.js | 10 ++++++++++ src/icons/currencies/Bitcoin.js | 10 ++++++++++ 15 files changed, 137 insertions(+), 20 deletions(-) create mode 100644 src/icons/Activity.js create mode 100644 src/icons/ArrowDown.js create mode 100644 src/icons/ArrowUp.js create mode 100644 src/icons/Devices.js create mode 100644 src/icons/PieChart.js create mode 100644 src/icons/Plus.js create mode 100644 src/icons/Search.js create mode 100644 src/icons/Settings.js create mode 100644 src/icons/currencies/Bitcoin.js diff --git a/src/components/DashboardPage/AccountCard.js b/src/components/DashboardPage/AccountCard.js index 82601c6c..8ccad93e 100644 --- a/src/components/DashboardPage/AccountCard.js +++ b/src/components/DashboardPage/AccountCard.js @@ -6,10 +6,11 @@ import type { Account } from 'types/common' import { formatBTC } from 'helpers/format' +import IconCurrencyBitcoin from 'icons/currencies/Bitcoin' + import { AreaChart } from 'components/base/Chart' import Bar from 'components/base/Bar' import Box, { Card } from 'components/base/Box' -import Icon from 'components/base/Icon' const AccountCard = ({ account, @@ -22,8 +23,8 @@ const AccountCard = ({ }) => ( - - + + diff --git a/src/components/GlobalSearch.js b/src/components/GlobalSearch.js index 3f5a791a..fe1fdcc7 100644 --- a/src/components/GlobalSearch.js +++ b/src/components/GlobalSearch.js @@ -3,8 +3,9 @@ import React, { PureComponent } from 'react' import styled from 'styled-components' +import IconSearch from 'icons/Search' + import Box from 'components/base/Box' -import Icon from 'components/base/Icon' const Input = styled.input` border: none; @@ -30,7 +31,7 @@ class GlobalSearch extends PureComponent<{}> { return ( - + (this._input = input)} /> diff --git a/src/components/SideBar/Item.js b/src/components/SideBar/Item.js index 9ab932e8..a3e00971 100644 --- a/src/components/SideBar/Item.js +++ b/src/components/SideBar/Item.js @@ -9,12 +9,12 @@ import { connect } from 'react-redux' import { openModal } from 'reducers/modals' +import type { Node } from 'react' import type { MapStateToProps } from 'react-redux' import type { Location } from 'react-router' import Box, { Tabbable } from 'components/base/Box' import Text from 'components/base/Text' -import Icon from 'components/base/Icon' const mapStateToProps: MapStateToProps<*, *, *> = (state: any) => ({ // connect router here only to make components re-render @@ -49,18 +49,30 @@ const Container = styled(Tabbable).attrs({ ` type Props = { + iconActiveColor?: string, children: string, linkTo?: string | null, modal?: string | null, desc?: string | null, - icon?: string | null, + icon?: Node | null, big?: boolean, location: Location, push: Function, openModal: Function, } -function Item({ big, children, desc, icon, linkTo, push, location, modal, openModal }: Props) { +function Item({ + big, + iconActiveColor, + children, + desc, + icon, + linkTo, + push, + location, + modal, + openModal, +}: Props) { const { pathname } = location const isActive = pathname === linkTo return ( @@ -73,7 +85,7 @@ function Item({ big, children, desc, icon, linkTo, push, location, modal, openMo } isActive={isActive} > - {icon && } + {icon && {icon}} {children} {desc && ( @@ -87,6 +99,7 @@ function Item({ big, children, desc, icon, linkTo, push, location, modal, openMo } Item.defaultProps = { + iconActiveColor: 'blue', big: false, desc: null, icon: null, diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js index 8eeb3398..5ec3acdb 100644 --- a/src/components/SideBar/index.js +++ b/src/components/SideBar/index.js @@ -17,9 +17,15 @@ import { getVisibleAccounts } from 'reducers/accounts' import { formatBTC } from 'helpers/format' +import IconPieChart from 'icons/PieChart' +import IconArrowDown from 'icons/ArrowDown' +import IconArrowUp from 'icons/ArrowUp' +import IconSettings from 'icons/Settings' +import IconPlus from 'icons/Plus' +import IconCurrencyBitcoin from 'icons/currencies/Bitcoin' + import Box, { Tabbable } from 'components/base/Box' import GrowScroll from 'components/base/GrowScroll' -import Icon from 'components/base/Icon' import Text from 'components/base/Text' import Item from './Item' @@ -88,16 +94,16 @@ class SideBar extends PureComponent { {t('sidebar.menu')} - + } linkTo="/"> {t('dashboard.title')} - + } modal={MODAL_SEND}> {t('send.title')} - + } modal={MODAL_RECEIVE}> {t('receive.title')} - + } linkTo="/settings"> {t('settings.title')} @@ -106,7 +112,7 @@ class SideBar extends PureComponent { {t('sidebar.accounts')} openModal(MODAL_ADD_ACCOUNT)}> - + @@ -114,7 +120,8 @@ class SideBar extends PureComponent { } key={account.id} linkTo={`/account/${account.id}`} > diff --git a/src/components/TopBar.js b/src/components/TopBar.js index 890ef6d2..a6dc5cfa 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -12,9 +12,11 @@ import { getAccounts } from 'reducers/accounts' import { lock } from 'reducers/application' import { hasPassword } from 'reducers/settings' +import IconDevices from 'icons/Devices' +import IconActivity from 'icons/Activity' + import Box from 'components/base/Box' import GlobalSearch from 'components/GlobalSearch' -import Icon from 'components/base/Icon' const Container = styled(Box).attrs({ px: 5, @@ -121,10 +123,10 @@ class TopBar extends PureComponent { - + - + diff --git a/src/components/base/Chart/index.js b/src/components/base/Chart/index.js index e9ebe6b0..4d33409c 100644 --- a/src/components/base/Chart/index.js +++ b/src/components/base/Chart/index.js @@ -105,7 +105,7 @@ export const AreaChart = ({ interval={0} dataKey="value" tickMargin={0} - stroke={false} + stroke={null} tickLine={false} tick={({ x, y, index, payload }) => { const { value } = payload diff --git a/src/icons/Activity.js b/src/icons/Activity.js new file mode 100644 index 00000000..c2909902 --- /dev/null +++ b/src/icons/Activity.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/ArrowDown.js b/src/icons/ArrowDown.js new file mode 100644 index 00000000..5f61404b --- /dev/null +++ b/src/icons/ArrowDown.js @@ -0,0 +1,13 @@ +// @flow + +import React from 'react' + +export default (props: Object) => ( + + + +) diff --git a/src/icons/ArrowUp.js b/src/icons/ArrowUp.js new file mode 100644 index 00000000..8c47886e --- /dev/null +++ b/src/icons/ArrowUp.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/Devices.js b/src/icons/Devices.js new file mode 100644 index 00000000..3702c353 --- /dev/null +++ b/src/icons/Devices.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/PieChart.js b/src/icons/PieChart.js new file mode 100644 index 00000000..f71778b4 --- /dev/null +++ b/src/icons/PieChart.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/Plus.js b/src/icons/Plus.js new file mode 100644 index 00000000..4a1a7bd0 --- /dev/null +++ b/src/icons/Plus.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/Search.js b/src/icons/Search.js new file mode 100644 index 00000000..a6705f5e --- /dev/null +++ b/src/icons/Search.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/Settings.js b/src/icons/Settings.js new file mode 100644 index 00000000..34f84527 --- /dev/null +++ b/src/icons/Settings.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +) diff --git a/src/icons/currencies/Bitcoin.js b/src/icons/currencies/Bitcoin.js new file mode 100644 index 00000000..9da6bfb6 --- /dev/null +++ b/src/icons/currencies/Bitcoin.js @@ -0,0 +1,10 @@ +import React from 'react' + +export default props => ( + + + +)