2021-12-02 17:49:13 +01:00
|
|
|
// @flow
|
|
|
|
import ChannelThumbnail from 'component/channelThumbnail';
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
claim?: Claim,
|
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) {
|
2021-12-06 19:06:40 +01:00
|
|
|
const { claim, 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 (
|
|
|
|
<div {...autocompleteProps}>
|
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
|
|
|
|
2021-12-06 19:06:40 +01:00
|
|
|
<div className="textareaSuggestion__label">
|
|
|
|
<span className="textareaSuggestion__title textareaSuggestion__value textareaSuggestion__value--emote">
|
|
|
|
{value}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (claim) {
|
|
|
|
const value = claim.canonical_url.replace('lbry://', '').replace('#', ':');
|
2021-12-02 17:49:13 +01:00
|
|
|
|
2021-12-06 19:06:40 +01:00
|
|
|
return (
|
|
|
|
<div {...autocompleteProps}>
|
|
|
|
<ChannelThumbnail xsmall uri={uri} />
|
|
|
|
|
|
|
|
<div className="textareaSuggestion__label">
|
|
|
|
<span className="textareaSuggestion__title">{(claim.value && claim.value.title) || value}</span>
|
|
|
|
<span className="textareaSuggestion__value">{value}</span>
|
|
|
|
</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
|
|
|
}
|