-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persona - onRenderCoin prop #3799
Merged
oengusmacinog-zz
merged 9 commits into
microsoft:master
from
oengusmacinog-zz:persona-coin-or-1094
Jan 26, 2018
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9936cf4
onRenderCoin prop that controls the image coin - with example
ae70398
onRenderCoin prop examples
9c8081d
cleaned up a console log
d1f84be
remove excess div by allowing null return in _onRenderCoin
8191668
updated example of custem element coin image
dc6e620
updated scss for better looking custom example
9f69787
refactored onRenderCoin implementation
2b1dc7c
change request plus css class standards fix
8416d7c
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
55 changes: 55 additions & 0 deletions
55
...fice-ui-fabric-react/src/components/Persona/examples/Persona.CustomCoinRender.Example.tsx
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,55 @@ | ||
import * as React from 'react'; | ||
import { autobind } from 'office-ui-fabric-react/lib/Utilities'; | ||
import { | ||
IPersonaProps, | ||
Persona, | ||
PersonaSize, | ||
PersonaPresence | ||
} from 'office-ui-fabric-react/lib/Persona'; | ||
import { Icon } from 'office-ui-fabric-react/lib/Icon'; | ||
import { TestImages } from '../../../common/TestImages'; | ||
import './PersonaExample.scss'; | ||
import * as exampleStylesImport from '../../../common/_exampleStyles.scss'; | ||
const exampleStyles: any = exampleStylesImport; | ||
|
||
const examplePersona = { | ||
imageUrl: TestImages.personaMale, | ||
imageInitials: 'TR', | ||
primaryText: 'Ted Randall', | ||
secondaryText: 'Project Manager', | ||
optionalText: 'Available at 4:00pm' | ||
}; | ||
|
||
export class PersonaCustomCoinRenderExample extends React.Component { | ||
|
||
public render() { | ||
return ( | ||
<div className='ms-PersonaExample'> | ||
<div className={ exampleStyles.exampleLabel }>Custom functional element in place of persona coin's image</div> | ||
<Persona | ||
{ ...examplePersona } | ||
size={ PersonaSize.size72 } | ||
presence={ PersonaPresence.online } | ||
onRenderCoin={ this._onRenderCoin } | ||
imageAlt={ 'Custom Coin Image' } | ||
coinSize={ 72 } | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
@autobind | ||
private _onRenderCoin(props: IPersonaProps): JSX.Element { | ||
let { | ||
coinSize, | ||
imageUrl, | ||
imageAlt, | ||
} = props; | ||
|
||
return ( | ||
<div className='custom-example-coin'> | ||
<img src={ imageUrl } alt={ imageAlt } width={ coinSize } height={ coinSize } /> | ||
</div> | ||
); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -10,4 +10,7 @@ | |
.example-label { | ||
margin: 10px 0; | ||
} | ||
.custom-example-coin img { | ||
border-radius: 20px; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't typically use the kebab-case naming convention for our classes, can you change this one and the one above to camelCase?