Fix glitch-soc textarea icons
This commit is contained in:
parent
6333900006
commit
e227e959f7
|
@ -1,4 +1,3 @@
|
||||||
// Package imports.
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
@ -6,9 +5,11 @@ import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
// Components.
|
import { ReactComponent as ForumIcon } from '@material-symbols/svg-600/outlined/forum.svg';
|
||||||
|
import { ReactComponent as HomeIcon } from '@material-symbols/svg-600/outlined/home-fill.svg';
|
||||||
|
|
||||||
import { Icon } from 'flavours/glitch/components/icon';
|
import { Icon } from 'flavours/glitch/components/icon';
|
||||||
// Messages.
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
localOnly: {
|
localOnly: {
|
||||||
defaultMessage: 'This post is local-only',
|
defaultMessage: 'This post is local-only',
|
||||||
|
@ -23,8 +24,8 @@ const messages = defineMessages({
|
||||||
// We use an array of tuples here instead of an object because it
|
// We use an array of tuples here instead of an object because it
|
||||||
// preserves order.
|
// preserves order.
|
||||||
const iconMap = [
|
const iconMap = [
|
||||||
['do_not_federate', 'home', messages.localOnly],
|
['do_not_federate', 'home', HomeIcon, messages.localOnly],
|
||||||
['threaded_mode', 'comments', messages.threadedMode],
|
['threaded_mode', 'comments', ForumIcon, messages.threadedMode],
|
||||||
];
|
];
|
||||||
|
|
||||||
class TextareaIcons extends ImmutablePureComponent {
|
class TextareaIcons extends ImmutablePureComponent {
|
||||||
|
@ -38,20 +39,17 @@ class TextareaIcons extends ImmutablePureComponent {
|
||||||
const { advancedOptions, intl } = this.props;
|
const { advancedOptions, intl } = this.props;
|
||||||
return (
|
return (
|
||||||
<div className='compose-form__textarea-icons'>
|
<div className='compose-form__textarea-icons'>
|
||||||
{advancedOptions ? iconMap.map(
|
{advancedOptions && iconMap.map(
|
||||||
([key, icon, message]) => advancedOptions.get(key) ? (
|
([key, icon, iconComponent, message]) => advancedOptions.get(key) && (
|
||||||
<span
|
<span
|
||||||
className='textarea_icon'
|
className='textarea_icon'
|
||||||
key={key}
|
key={key}
|
||||||
title={intl.formatMessage(message)}
|
title={intl.formatMessage(message)}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon id={icon} icon={iconComponent} />
|
||||||
fixedWidth
|
|
||||||
id={icon}
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
) : null,
|
),
|
||||||
) : null}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue