diff --git a/web/markdown/markdown-chat-mention.react.js b/web/markdown/markdown-chat-mention.react.js new file mode 100644 --- /dev/null +++ b/web/markdown/markdown-chat-mention.react.js @@ -0,0 +1,34 @@ +// @flow + +import * as React from 'react'; + +import type { ResolvedThreadInfo } from 'lib/types/thread-types.js'; + +import css from './markdown.css'; +import { useOnClickThread } from '../selectors/thread-selectors.js'; + +type MarkdownSpoilerProps = { + +threadInfo: ResolvedThreadInfo, + +hasAccessToChat: boolean, + +text: string, +}; + +function MarkdownSpoiler(props: MarkdownSpoilerProps): React.Node { + const { threadInfo, hasAccessToChat, text } = props; + const onClick = useOnClickThread(threadInfo); + + if (!hasAccessToChat) { + return text; + } + + return ( + + {text} + + ); +} + +const MemoizedMarkdownSpoiler: React.ComponentType = + React.memo(MarkdownSpoiler); + +export default MemoizedMarkdownSpoiler; diff --git a/web/markdown/markdown.css b/web/markdown/markdown.css --- a/web/markdown/markdown.css +++ b/web/markdown/markdown.css @@ -104,3 +104,7 @@ color: white; } } + +strong.chatMention { + cursor: pointer; +}