Skip to content

Commit

Permalink
refactor: Use svgr icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Nov 12, 2020
1 parent c4fdc6e commit 88649ee
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/ducks/balance/NoAccount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { Container, Content } from 'components/VerticalBox'
import BarTheme from 'ducks/bar/BarTheme'
import styles from 'ducks/balance/NoAccount.styl'

import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
import Icon from 'cozy-ui/transpiled/react/Icon'

const NoAccount = () => {
const { isMobile } = useBreakpoints()
const { t, lang } = useI18n()
Expand All @@ -27,7 +30,7 @@ const NoAccount = () => {
<AddAccountLink>
<Button
theme="highlight"
icon="plus"
icon={<Icon icon={PlusIcon} />}
size="large"
className={styles.NoAccount_addButton}
label={t('Accounts.add_bank')}
Expand Down
5 changes: 4 additions & 1 deletion src/ducks/categories/AddAccountButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import styles from 'ducks/categories/AddAccountButton.styl'
import cx from 'classnames'
import { trackEvent } from 'ducks/tracking/browser'

import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
import Icon from 'cozy-ui/transpiled/react/Icon'

const sleep = time => new Promise(resolve => setTimeout(resolve, time))
const AddAccountButton = ({
label,
Expand All @@ -16,7 +19,7 @@ const AddAccountButton = ({
<AddAccountLink>
<Button
theme="highlight"
icon="plus"
icon={<Icon icon={PlusIcon} />}
size="large"
className={cx(
styles.AddAccountLink,
Expand Down
7 changes: 5 additions & 2 deletions src/ducks/recurrence/RecurrencePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { BarTitle } from 'components/Title/PageTitle'
import TransactionsTableHead from 'ducks/transactions/header/TableHead'

import { BarRight } from 'components/Bar'
import { BarButton, ActionMenu, Icon } from 'cozy-ui/transpiled/react'
import { BarButton, ActionMenu } from 'cozy-ui/transpiled/react'
import {
ActionMenuItem,
ActionMenuRadio
Expand All @@ -63,6 +63,9 @@ import PenIcon from 'cozy-ui/transpiled/react/Icons/Pen'
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash'
import BottomIcon from 'cozy-ui/transpiled/react/Icons/Bottom'

import DotsIcon from 'cozy-ui/transpiled/react/Icons/Dots'
import Icon from 'cozy-ui/transpiled/react/Icon'

// TODO We should need to do this (isMobile ? portal : identity) but see
// Cozy-UI's issue: https://github.com/cozy/cozy-ui/issues/1462
const identity = x => x
Expand Down Expand Up @@ -338,7 +341,7 @@ const BundleInfo = ({ bundle }) => {
iconOnly
label={t('Recurrence.action-menu.open-button')}
extension="narrow"
icon="dots"
icon={<Icon icon={DotsIcon} />}
theme="secondary"
/>
}
Expand Down
5 changes: 4 additions & 1 deletion src/ducks/settings/AddRuleButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import styles from './Rules.styl'
import cx from 'classnames'
import Button from 'cozy-ui/transpiled/react/Button'

import PlusIcon from 'cozy-ui/transpiled/react/Icons/Plus'
import Icon from 'cozy-ui/transpiled/react/Icon'

const AddRuleButton = ({ label, busy, onClick }) => (
<Button
className={cx('u-ml-1 u-mb-0', styles.AddRuleButton)}
theme="subtle"
icon="plus"
icon={<Icon icon={PlusIcon} />}
size="small"
label={label}
busy={busy}
Expand Down
22 changes: 11 additions & 11 deletions src/ducks/transactions/TransactionActions.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jest.mock('cozy-ui/transpiled/react/Icon', () => {
const OriginalIcon = jest.requireActual('cozy-ui/transpiled/react/Icon')
const mockIcon = props => {
const icon = props.icon
return OriginalIcon.default.isProperIcon(icon) ? (
<span data-icon-id={icon.id || icon} />
return OriginalIcon.default.isProperIcon(icon) || icon.name ? (
<span data-icon-id={icon.id || icon.name || icon} />
) : (
icon
)
Expand All @@ -42,17 +42,17 @@ jest.mock('cozy-ui/transpiled/react/Icon', () => {
/* eslint-disable */
const tests = [
// transaction id, class variant, text, icon, action name, [action props], [test name]
['paiementdocteur', null, 'Ameli+17.50€|Malakoff Mederic+7.50€', 'file-outline|file-outline', 'AttachedDocs'],
['paiementdocteur2', 'error', 'Late reimbursement', 'hourglass', 'ReimbursementStatus'],
['depsantelou1', 'error', 'Late reimbursement', 'hourglass', 'ReimbursementStatus'],
['depsantegene4', 'error', 'Late reimbursement', 'hourglass', 'ReimbursementStatus'],
['depsanteisa2', 'error', 'Late reimbursement', 'hourglass', 'ReimbursementStatus'],
['depsantecla3', 'error', 'Late reimbursement', 'hourglass', 'ReimbursementStatus'],
['facturebouygues', null, 'Invoice', 'file-outline', 'AttachedDocs', {
['paiementdocteur', null, 'Ameli+17.50€|Malakoff Mederic+7.50€', 'SvgFileOutline|SvgFileOutline', 'AttachedDocs'],
['paiementdocteur2', 'error', 'Late reimbursement', 'SvgHourglass', 'ReimbursementStatus'],
['depsantelou1', 'error', 'Late reimbursement', 'SvgHourglass', 'ReimbursementStatus'],
['depsantegene4', 'error', 'Late reimbursement', 'SvgHourglass', 'ReimbursementStatus'],
['depsanteisa2', 'error', 'Late reimbursement', 'SvgHourglass', 'ReimbursementStatus'],
['depsantecla3', 'error', 'Late reimbursement', 'SvgHourglass', 'ReimbursementStatus'],
['facturebouygues', null, 'Invoice', 'SvgFileOutline', 'AttachedDocs', {
brands: brands.filter(x => x.name === 'Bouygues Telecom').map(b => ({ ...b, hasTrigger: true }))
}],
['salaireisa1', null, 'Accéder à votre paie', 'openwith', 'url'],
['fnac', null, 'Accéder au site Fnac', 'openwith', 'url'],
['salaireisa1', null, 'Accéder à votre paie', 'SvgOpenwith', 'url'],
['fnac', null, 'Accéder au site Fnac', 'SvgOpenwith', 'url'],
['edf', null, 'EDF', null, 'app'],
['remboursementcomplementaire', null, 'Invoice', null, 'AttachedDocs', {
brands: brands.filter(x => x.name == 'Malakoff Mederic')
Expand Down

0 comments on commit 88649ee

Please sign in to comment.