Refactor link/emoji/newline components for composability

This commit is contained in:
Scott Nonnenberg
2018-05-18 14:48:20 -07:00
parent a5416e42c4
commit d9e5338dff
11 changed files with 295 additions and 95 deletions

View 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}
/>;
```