Emojify and linkify group descriptions

This commit is contained in:
Evan Hahn 2021-06-17 12:15:51 -05:00 committed by GitHub
parent 68f1023946
commit 65a1e82857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 18 deletions

View file

@ -0,0 +1,24 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { FunctionComponent } from 'react';
import { RenderTextCallbackType } from '../types/Util';
import { AddNewLines } from './conversation/AddNewLines';
import { Emojify } from './conversation/Emojify';
import { Linkify } from './conversation/Linkify';
type PropsType = {
text: string;
};
const renderNonLink: RenderTextCallbackType = ({ key, text }) => (
<Emojify key={key} text={text} />
);
const renderNonNewLine: RenderTextCallbackType = ({ key, text }) => (
<Linkify key={key} text={text} renderNonLink={renderNonLink} />
);
export const GroupDescriptionText: FunctionComponent<PropsType> = ({
text,
}) => <AddNewLines text={text} renderNonNewLine={renderNonNewLine} />;