From f154d9d6e9ca461cf608674494cb23eee6db6534 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Mon, 9 Sep 2019 15:28:45 +0200 Subject: [PATCH] Use upstream's Icon component Rework the codebase to avoid unnecessary differences with upstream --- .../flavours/glitch/components/icon.js | 41 ++++++++----------- .../flavours/glitch/components/icon_button.js | 5 ++- .../glitch/components/icon_with_badge.js | 2 +- .../features/account/components/action_bar.js | 2 +- .../features/account/components/header.js | 4 +- .../flavours/glitch/features/audio/index.js | 4 +- .../compose/components/dropdown_menu.js | 2 +- .../features/compose/components/header.js | 14 +++---- .../features/compose/components/poll_form.js | 4 +- .../features/compose/components/publisher.js | 4 +- .../features/compose/components/search.js | 4 +- .../compose/components/search_results.js | 8 ++-- .../compose/components/textarea_icons.js | 4 +- .../features/compose/components/upload.js | 2 +- .../compose/components/upload_progress.js | 2 +- .../features/ui/components/actions_modal.js | 4 +- .../features/ui/components/list_panel.js | 2 +- .../ui/components/navigation_panel.js | 20 ++++----- 18 files changed, 62 insertions(+), 66 deletions(-) diff --git a/app/javascript/flavours/glitch/components/icon.js b/app/javascript/flavours/glitch/components/icon.js index 8f55a0115..d8a17722f 100644 --- a/app/javascript/flavours/glitch/components/icon.js +++ b/app/javascript/flavours/glitch/components/icon.js @@ -1,26 +1,21 @@ -// Package imports. -import classNames from 'classnames'; -import PropTypes from 'prop-types'; import React from 'react'; +import PropTypes from 'prop-types'; +import classNames from 'classnames'; + +export default class Icon extends React.PureComponent { + + static propTypes = { + id: PropTypes.string.isRequired, + className: PropTypes.string, + fixedWidth: PropTypes.bool, + }; + + render () { + const { id, className, fixedWidth, ...other } = this.props; + + return ( + + ); + } -// This just renders a FontAwesome icon. -export default function Icon ({ - className, - fullwidth, - icon, -}) { - const computedClass = classNames('icon', 'fa', { 'fa-fw': fullwidth }, `fa-${icon}`, className); - return icon ? ( -