Skip to content

Commit

Permalink
Fix glitch-soc textarea icons
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Jan 13, 2024
1 parent 6333900 commit e88ff45
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// Package imports.
import PropTypes from 'prop-types';

import { defineMessages, injectIntl } from 'react-intl';

import ImmutablePropTypes from 'react-immutable-proptypes';
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';
// Messages.

const messages = defineMessages({
localOnly: {
defaultMessage: 'This post is local-only',
Expand All @@ -23,8 +24,8 @@ const messages = defineMessages({
// We use an array of tuples here instead of an object because it
// preserves order.
const iconMap = [
['do_not_federate', 'home', messages.localOnly],
['threaded_mode', 'comments', messages.threadedMode],
['do_not_federate', 'home', HomeIcon, messages.localOnly],
['threaded_mode', 'comments', ForumIcon, messages.threadedMode],
];

class TextareaIcons extends ImmutablePureComponent {
Expand All @@ -38,20 +39,17 @@ class TextareaIcons extends ImmutablePureComponent {
const { advancedOptions, intl } = this.props;
return (
<div className='compose-form__textarea-icons'>
{advancedOptions ? iconMap.map(
([key, icon, message]) => advancedOptions.get(key) ? (
{advancedOptions && iconMap.map(
([key, icon, iconComponent, message]) => advancedOptions.get(key) && (
<span
className='textarea_icon'
key={key}
title={intl.formatMessage(message)}
>
<Icon
fixedWidth
id={icon}
/>
<Icon id={icon} iconComponent={iconComponent} />
</span>
) : null,
) : null}
),
)}
</div>
);
}
Expand Down

0 comments on commit e88ff45

Please sign in to comment.