From 3eb4eeed59ae562171028e79ccd9a4a52a633f48 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 22 Sep 2021 14:38:48 -0500 Subject: [PATCH] Composer: use Tabler svg icons --- .../compose/components/markdown_button.js | 45 +++++++++++++++++++ .../compose/components/poll_button.js | 12 +---- .../compose/components/privacy_dropdown.js | 15 +++---- .../compose/components/schedule_button.js | 13 ++---- .../compose/components/spoiler_button.js | 40 +++++++++++++++++ .../compose/components/upload_button.js | 13 +++--- .../containers/markdown_button_container.js | 13 +----- .../containers/spoiler_button_container.js | 13 +----- app/styles/components/compose-form.scss | 30 +++++++++++-- 9 files changed, 133 insertions(+), 61 deletions(-) create mode 100644 app/soapbox/features/compose/components/markdown_button.js create mode 100644 app/soapbox/features/compose/components/spoiler_button.js diff --git a/app/soapbox/features/compose/components/markdown_button.js b/app/soapbox/features/compose/components/markdown_button.js new file mode 100644 index 000000000..f8443e249 --- /dev/null +++ b/app/soapbox/features/compose/components/markdown_button.js @@ -0,0 +1,45 @@ +import React from 'react'; +import IconButton from '../../../components/icon_button'; +import PropTypes from 'prop-types'; +import { defineMessages, injectIntl } from 'react-intl'; +import classNames from 'classnames'; + +const messages = defineMessages({ + marked: { id: 'compose_form.markdown.marked', defaultMessage: 'Post markdown enabled' }, + unmarked: { id: 'compose_form.markdown.unmarked', defaultMessage: 'Post markdown disabled' }, +}); + +export default @injectIntl +class MarkdownButton extends React.PureComponent { + + static propTypes = { + active: PropTypes.bool, + onClick: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + unavailable: PropTypes.bool, + }; + + handleClick = () => { + this.props.onClick(); + } + + render() { + const { intl, active, unavailable } = this.props; + + if (unavailable) { + return null; + } + + return ( +
+ +
+ ); + } + +} diff --git a/app/soapbox/features/compose/components/poll_button.js b/app/soapbox/features/compose/components/poll_button.js index d774118cc..5a2f20769 100644 --- a/app/soapbox/features/compose/components/poll_button.js +++ b/app/soapbox/features/compose/components/poll_button.js @@ -8,11 +8,6 @@ const messages = defineMessages({ remove_poll: { id: 'poll_button.remove_poll', defaultMessage: 'Remove poll' }, }); -const iconStyle = { - height: null, - lineHeight: '27px', -}; - export default @injectIntl class PollButton extends React.PureComponent { @@ -39,14 +34,11 @@ 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 f6fd27d28..ae65a84ed 100644 --- a/app/soapbox/features/compose/components/privacy_dropdown.js +++ b/app/soapbox/features/compose/components/privacy_dropdown.js @@ -131,7 +131,7 @@ class PrivacyDropdownMenu extends React.PureComponent { {items.map(item => (
- +
@@ -171,10 +171,10 @@ class PrivacyDropdown extends React.PureComponent { const { intl: { formatMessage } } = props; this.options = [ - { icon: 'globe-w', value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) }, - { icon: 'unlock', value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long) }, - { icon: 'lock', value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) }, - { icon: 'envelope', value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) }, + { icon: require('@tabler/icons/icons/world.svg'), value: 'public', text: formatMessage(messages.public_short), meta: formatMessage(messages.public_long) }, + { icon: require('@tabler/icons/icons/lock-open.svg'), value: 'unlisted', text: formatMessage(messages.unlisted_short), meta: formatMessage(messages.unlisted_long) }, + { icon: require('@tabler/icons/icons/lock.svg'), value: 'private', text: formatMessage(messages.private_short), meta: formatMessage(messages.private_long) }, + { icon: require('@tabler/icons/icons/mail.svg'), value: 'direct', text: formatMessage(messages.direct_short), meta: formatMessage(messages.direct_long) }, ]; } @@ -252,16 +252,13 @@ class PrivacyDropdown extends React.PureComponent {
diff --git a/app/soapbox/features/compose/components/schedule_button.js b/app/soapbox/features/compose/components/schedule_button.js index 31218fcaf..5744509ee 100644 --- a/app/soapbox/features/compose/components/schedule_button.js +++ b/app/soapbox/features/compose/components/schedule_button.js @@ -2,17 +2,13 @@ import React from 'react'; import IconButton from '../../../components/icon_button'; import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; +import classNames from 'classnames'; const messages = defineMessages({ add_schedule: { id: 'schedule_button.add_schedule', defaultMessage: 'Schedule post for later' }, remove_schedule: { id: 'schedule_button.remove_schedule', defaultMessage: 'Post immediately' }, }); -const iconStyle = { - height: null, - lineHeight: '27px', -}; - export default @injectIntl class ScheduleButton extends React.PureComponent { @@ -34,14 +30,11 @@ class ScheduleButton extends React.PureComponent { return (
); diff --git a/app/soapbox/features/compose/components/spoiler_button.js b/app/soapbox/features/compose/components/spoiler_button.js new file mode 100644 index 000000000..4f0b8fb64 --- /dev/null +++ b/app/soapbox/features/compose/components/spoiler_button.js @@ -0,0 +1,40 @@ +import React from 'react'; +import IconButton from '../../../components/icon_button'; +import PropTypes from 'prop-types'; +import { defineMessages, injectIntl } from 'react-intl'; +import classNames from 'classnames'; + +const messages = defineMessages({ + marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Text is hidden behind warning' }, + unmarked: { id: 'compose_form.spoiler.unmarked', defaultMessage: 'Text is not hidden' }, +}); + +export default @injectIntl +class SpoilerButton extends React.PureComponent { + + static propTypes = { + active: PropTypes.bool, + onClick: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + }; + + handleClick = () => { + this.props.onClick(); + } + + render() { + const { intl, active } = this.props; + + return ( +
+ +
+ ); + } + +} diff --git a/app/soapbox/features/compose/components/upload_button.js b/app/soapbox/features/compose/components/upload_button.js index 32472d9a2..52125db83 100644 --- a/app/soapbox/features/compose/components/upload_button.js +++ b/app/soapbox/features/compose/components/upload_button.js @@ -18,11 +18,6 @@ const makeMapStateToProps = () => { return mapStateToProps; }; -const iconStyle = { - height: null, - lineHeight: '27px', -}; - export default @connect(makeMapStateToProps) @injectIntl class UploadButton extends ImmutablePureComponent { @@ -60,7 +55,13 @@ class UploadButton extends ImmutablePureComponent { return (
- +