From 890299ead0157fbdcef32270d950485a22c4b1e6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 21 Mar 2022 17:04:44 -0500 Subject: [PATCH] ComposeForm: convert buttons to ComposeFormButton component --- .../components/compose_form_button.tsx | 34 +++++++++++++++++++ .../compose/components/markdown_button.js | 17 ++++------ .../compose/components/poll_button.js | 18 +++++----- .../compose/components/privacy_dropdown.js | 4 +-- .../compose/components/schedule_button.js | 19 +++++------ .../compose/components/spoiler_button.js | 17 ++++------ 6 files changed, 66 insertions(+), 43 deletions(-) create mode 100644 app/soapbox/features/compose/components/compose_form_button.tsx diff --git a/app/soapbox/features/compose/components/compose_form_button.tsx b/app/soapbox/features/compose/components/compose_form_button.tsx new file mode 100644 index 000000000..3f80c4b6a --- /dev/null +++ b/app/soapbox/features/compose/components/compose_form_button.tsx @@ -0,0 +1,34 @@ +import classNames from 'classnames'; +import React from 'react'; + +import { IconButton } from 'soapbox/components/ui'; + +interface IComposeFormButton { + icon: string, + title?: string, + active?: boolean, + disabled?: boolean, + onClick: () => void, +} + +const ComposeFormButton: React.FC = ({ + icon, + title, + active, + disabled, + onClick, +}) => { + return ( +
+ +
+ ); +}; + +export default ComposeFormButton; diff --git a/app/soapbox/features/compose/components/markdown_button.js b/app/soapbox/features/compose/components/markdown_button.js index 202bc0cf7..0d4b294a7 100644 --- a/app/soapbox/features/compose/components/markdown_button.js +++ b/app/soapbox/features/compose/components/markdown_button.js @@ -1,9 +1,8 @@ -import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import ComposeFormButton from './compose_form_button'; const messages = defineMessages({ marked: { id: 'compose_form.markdown.marked', defaultMessage: 'Post markdown enabled' }, @@ -27,14 +26,12 @@ class MarkdownButton extends React.PureComponent { const { intl, active } = this.props; return ( -
- -
+ ); } diff --git a/app/soapbox/features/compose/components/poll_button.js b/app/soapbox/features/compose/components/poll_button.js index a9d607d04..bc0f25a06 100644 --- a/app/soapbox/features/compose/components/poll_button.js +++ b/app/soapbox/features/compose/components/poll_button.js @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import ComposeFormButton from './compose_form_button'; const messages = defineMessages({ add_poll: { id: 'poll_button.add_poll', defaultMessage: 'Add a poll' }, @@ -33,15 +33,13 @@ class PollButton extends React.PureComponent { } return ( -
- -
+ ); } diff --git a/app/soapbox/features/compose/components/privacy_dropdown.js b/app/soapbox/features/compose/components/privacy_dropdown.js index 3c7f011e1..415789ba5 100644 --- a/app/soapbox/features/compose/components/privacy_dropdown.js +++ b/app/soapbox/features/compose/components/privacy_dropdown.js @@ -8,7 +8,7 @@ import Overlay from 'react-overlays/lib/Overlay'; import Icon from 'soapbox/components/icon'; -import IconButton from '../../../components/icon_button'; +import { IconButton } from '../../../components/ui'; import Motion from '../../ui/util/optional_motion'; const messages = defineMessages({ @@ -253,7 +253,7 @@ class PrivacyDropdown extends React.PureComponent {
- -
+ ); } diff --git a/app/soapbox/features/compose/components/spoiler_button.js b/app/soapbox/features/compose/components/spoiler_button.js index 4a90a3336..13ec3083e 100644 --- a/app/soapbox/features/compose/components/spoiler_button.js +++ b/app/soapbox/features/compose/components/spoiler_button.js @@ -1,9 +1,8 @@ -import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { defineMessages, injectIntl } from 'react-intl'; -import IconButton from '../../../components/icon_button'; +import ComposeFormButton from './compose_form_button'; const messages = defineMessages({ marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Text is hidden behind warning' }, @@ -27,14 +26,12 @@ class SpoilerButton extends React.PureComponent { const { intl, active } = this.props; return ( -
- -
+ ); }