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

Allow element types as Avatar children #198

Closed
lwansbrough opened this issue Dec 22, 2016 · 2 comments
Closed

Allow element types as Avatar children #198

lwansbrough opened this issue Dec 22, 2016 · 2 comments
Milestone

Comments

@lwansbrough
Copy link

I have a custom icon (an SVG element) I'd like to put in an Avatar. I can do it, but I get an error/warning about prop types.

@mlaursen
Copy link
Owner

Is there a reason you can't do:

render() {
  const icon = <FontIcon iconClassName={null}><svg ..... /></FontIcon>;
  return <Avatar icon={icon} />;
}

or

render() {
  return <Avatar src={svgPath} alt="Alt describing icon" />;
}

?

I do think that it is still ok to update the PropTypes to allow more than just string for the children prop.

@mlaursen mlaursen added this to the v1.0.1 milestone Dec 22, 2016
@lwansbrough
Copy link
Author

@mlaursen Yup that might also be a solution!

mlaursen added a commit that referenced this issue Jan 4, 2017
It should be completely valid to have any element as a child for the
Avatar component, so the prop was updated to allow PropTypes.node.
@mlaursen mlaursen closed this as completed Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants