Skip to content
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

Conversation

oengusmacinog-zz
Copy link
Collaborator

Pull request checklist

Description of changes

Added an onRenderCoin prop to Persona to allow for passing in or JSX for expanded functionality. Pretty basic set up right now and I am open to suggestions on how to polish this into a solid feature of this component.

Focus areas to test

Open to suggestions

@autobind
private _onRenderCoin(props: IPersonaProps, size: number): JSX.Element {
if (props.onRenderCoin) {
console.log(size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably wasn't meant to be included in the commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll clean that up. I was attempting to make a slightly better example to show. If you have any ideas on that let me know.

if (props.onRenderCoin) {
console.log(size);
return(
<div>
Copy link
Contributor

@mikewheaton mikewheaton Jan 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the Coin need to be wrapped in these divs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the change I just committed is a bit cleaner. The div can be removed if a null return from _onRenderCoin is allowed which would just print nothing.

shouldStartVisible={ imageShouldStartVisible }
onLoadingStateChange={ this._onPhotoLoadingStateChange }
/>
{ this._onRenderCoin( this.props, size ) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onRenderCoin could be refactored a bit. IRenderFunction should take props and the default render as parameters. See Tooltip's onRenderContent for example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice! yeah that's much cleaner thank you so much!

@@ -5,7 +5,8 @@ import {
divProperties,
getInitials,
getNativeProps,
getRTL
getRTL,
IRenderFunction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IRenderFunction isn't used

@gokunymbus
Copy link
Contributor

Please run npm run change and commit that change file.

@@ -10,4 +10,7 @@
.example-label {
margin: 10px 0;
}
.custom-example-coin img {
Copy link
Contributor

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?

@mikewheaton
Copy link
Contributor

As @jordandrako pointed out, the Screener regressions are on the master branch and are unrelated to this change.

@oengusmacinog-zz oengusmacinog-zz merged commit 071a6da into microsoft:master Jan 26, 2018
@oengusmacinog-zz oengusmacinog-zz deleted the persona-coin-or-1094 branch January 26, 2018 22:14
chrismohr pushed a commit to chrismohr/office-ui-fabric-react that referenced this pull request Apr 17, 2018
…oft#3799)

onRenderCoin prop that controls the image coin - with example
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persona: Make a way to customize the Image component
4 participants