mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-25 02:48:23 +01:00
Refactor link/emoji/newline components for composability
This commit is contained in:
35
ts/components/conversation/AddNewLines.md
Normal file
35
ts/components/conversation/AddNewLines.md
Normal file
@@ -0,0 +1,35 @@
|
||||
### All newlines
|
||||
|
||||
```jsx
|
||||
<AddNewLines text="\n\n\n" />
|
||||
```
|
||||
|
||||
### Starting and ending with newlines
|
||||
|
||||
```jsx
|
||||
<AddNewLines text="\nin between\n" />
|
||||
```
|
||||
|
||||
### With newlines in the middle
|
||||
|
||||
```jsx
|
||||
<AddNewLines text="Before \n\n after" />
|
||||
```
|
||||
|
||||
### No newlines
|
||||
|
||||
```jsx
|
||||
<AddNewLines text="This is the text" />
|
||||
```
|
||||
|
||||
### Providing custom non-newline render function
|
||||
|
||||
```jsx
|
||||
const renderNonNewLine = ({ text, key }) => (
|
||||
<span key={key}>This is my custom content!</span>
|
||||
);
|
||||
<AddNewLines
|
||||
text="\n first \n second \n"
|
||||
renderNonNewLine={renderNonNewLine}
|
||||
/>;
|
||||
```
|
||||
Reference in New Issue
Block a user