2021-12-02 17:49:13 +01:00
|
|
|
// @flow
|
|
|
|
import ChannelThumbnail from 'component/channelThumbnail';
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
type Props = {
|
2022-02-02 13:49:02 +01:00
|
|
|
claimLabel?: string,
|
|
|
|
claimTitle?: string,
|
2021-12-06 19:06:40 +01:00
|
|
|
emote?: any,
|
2021-12-02 17:49:13 +01:00
|
|
|
uri?: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function TextareaSuggestionsItem(props: Props) {
|
2022-02-02 13:49:02 +01:00
|
|
|
const { claimLabel, claimTitle, emote, uri, ...autocompleteProps } = props;
|
2021-12-02 17:49:13 +01:00
|
|
|
|
2021-12-06 19:06:40 +01:00
|
|
|
if (emote) {
|
2021-12-06 21:38:13 +01:00
|
|
|
const { name: value, url, unicode } = emote;
|
2021-12-02 17:49:13 +01:00
|
|
|
|
2021-12-06 19:06:40 +01:00
|
|
|
return (
|
2021-12-07 13:52:36 +01:00
|
|
|
<div {...autocompleteProps} dispatch={undefined}>
|
2021-12-06 21:38:13 +01:00
|
|
|
{unicode ? <div className="emote">{unicode}</div> : <img className="emote" src={url} />}
|
2021-12-02 17:49:13 +01:00
|
|
|
|
2022-02-02 13:49:02 +01:00
|
|
|
<div className="textarea-suggestion__label">
|
|
|
|
<span className="textarea-suggestion__title textarea-suggestion__value textarea-suggestion__value--emote">
|
2021-12-06 19:06:40 +01:00
|
|
|
{value}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-02-02 13:49:02 +01:00
|
|
|
if (claimLabel) {
|
|
|
|
const value = claimLabel;
|
2021-12-02 17:49:13 +01:00
|
|
|
|
2021-12-06 19:06:40 +01:00
|
|
|
return (
|
2021-12-07 13:52:36 +01:00
|
|
|
<div {...autocompleteProps} dispatch={undefined}>
|
2021-12-06 19:06:40 +01:00
|
|
|
<ChannelThumbnail xsmall uri={uri} />
|
|
|
|
|
2022-02-02 13:49:02 +01:00
|
|
|
<div className="textarea-suggestion__label">
|
|
|
|
<span className="textarea-suggestion__title">{claimTitle || value}</span>
|
|
|
|
<span className="textarea-suggestion__value">{value}</span>
|
2021-12-06 19:06:40 +01:00
|
|
|
</div>
|
2021-12-02 17:49:13 +01:00
|
|
|
</div>
|
2021-12-06 19:06:40 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2021-12-02 17:49:13 +01:00
|
|
|
}
|