forked from signavio/react-mentions
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RenderInput signavio#622 (#14)
- Loading branch information
Showing
6 changed files
with
120 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"react-mentions": minor | ||
--- | ||
|
||
Added RenderInput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react' | ||
|
||
import { Mention, MentionsInput } from '../../../src' | ||
|
||
import { provideExampleValue } from './higher-order' | ||
import defaultStyle from './defaultStyle' | ||
import defaultMentionStyle from './defaultMentionStyle' | ||
|
||
const CustomRenderer = React.forwardRef((props, ref) => ( | ||
<label> | ||
I am a custom input! | ||
<input type="text" {...props} ref={ref} /> | ||
</label> | ||
)) | ||
|
||
function RenderInput({ value, data, onChange, onAdd }) { | ||
return ( | ||
<div className="single-line"> | ||
<h3>Single line input</h3> | ||
|
||
<MentionsInput | ||
renderInput={CustomRenderer} | ||
value={value} | ||
onChange={onChange} | ||
style={defaultStyle} | ||
placeholder={"Mention people using '@'"} | ||
a11ySuggestionsListLabel={'Suggested mentions'} | ||
> | ||
<Mention data={data} onAdd={onAdd} style={defaultMentionStyle} /> | ||
</MentionsInput> | ||
</div> | ||
) | ||
} | ||
|
||
const asExample = provideExampleValue('') | ||
|
||
export default asExample(RenderInput) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.