Skip to content

Persona - onRenderCoin prop#3799

Merged
oengusmacinog-zz merged 9 commits into
microsoft:masterfrom
oengusmacinog-zz:persona-coin-or-1094
Jan 26, 2018
Merged

Persona - onRenderCoin prop#3799
oengusmacinog-zz merged 9 commits into
microsoft:masterfrom
oengusmacinog-zz:persona-coin-or-1094

Conversation

@oengusmacinog-zz

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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>

@mikewheaton mikewheaton Jan 25, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

getNativeProps,
getRTL
getRTL,
IRenderFunction

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Please run npm run change and commit that change file.

.example-label {
margin: 10px 0;
}
.custom-example-coin img {

Copy link
Copy Markdown
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
Copy Markdown
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
@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