0
0
Fork 0

Refactor icons in web UI to use Icon component (#9951)

* Refactor uses of icons to an Icon component in web UI

* Refactor options passed to the Icon component

* Make tests work with absolute component paths
This commit is contained in:
Eugen Rochko 2019-02-01 00:14:05 +01:00 committed by GitHub
parent 3383ed7573
commit 1f95190202
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 147 additions and 82 deletions

View file

@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import Icon from 'mastodon/components/icon';
const ColumnLink = ({ icon, text, to, href, method, badge }) => {
const badgeElement = typeof badge !== 'undefined' ? <span className='column-link__badge'>{badge}</span> : null;
@ -8,7 +9,7 @@ const ColumnLink = ({ icon, text, to, href, method, badge }) => {
if (href) {
return (
<a href={href} className='column-link' data-method={method}>
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
<Icon id={icon} fixedWidth className='column-link__icon' />
{text}
{badgeElement}
</a>
@ -16,7 +17,7 @@ const ColumnLink = ({ icon, text, to, href, method, badge }) => {
} else {
return (
<Link to={to} className='column-link'>
<i className={`fa fa-fw fa-${icon} column-link__icon`} />
<Icon id={icon} fixedWidth className='column-link__icon' />
{text}
{badgeElement}
</Link>