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

Add mixin for img when src is specified #86

Closed
wants to merge 2 commits into from

Conversation

bennypowers
Copy link

@bennypowers bennypowers commented Nov 20, 2016

When src is specified, the --iron-icon mixin does not enable the user to apply styles directly to the created img tag. Adding a new mixin for this purposes allows users to style the image, for example adding border-radius: 50% for a rounded avatar.

Graphic Illustration

screen shot 2016-11-20 at 4 50 23 pm

<style>
      .userProfile {
        --iron-icon-image: {
          border-radius: 50%;
        };
      }
      .userProfile2 {
        --iron-icon: {
          border: 1px solid red;
          border-radius: 50%;
        };
      }
</style>

<paper-icon-button alt="User Profile" src="[[user.photoURL]]" class="userProfile"></paper-icon-button>

<paper-icon-button alt="User Profile" src="[[user.photoURL]]" class="userProfile2"></paper-icon-button>

Benny Powers added 2 commits November 20, 2016 16:34
When `src` is specified, the `--iron-icon` mixin does not enable the user to apply styles directly to the created `img` tag. Adding a new mixin for this purposes allows users to style the image, for example adding `border-radius: 50%` for a rounded avatar.
Added mixin for image when src used.
@tony19
Copy link

tony19 commented Nov 21, 2016

FYI, If your goal is to round a square image, that's already possible:

paper-icon-button {
  width: 64px;
  height: 64px;
  --iron-icon: {
    border-radius: 50%;
    overflow: hidden;  /* hide overflow of underlying image */
  };
}

codepen

@tony19
Copy link

tony19 commented Nov 21, 2016

Related to #84

@notwaldorf
Copy link
Contributor

notwaldorf commented Dec 5, 2016

Closing, as this isn't needed (@tony19's workaround is correct).

Please re-open if there's still something this mixin is needed for

@notwaldorf notwaldorf closed this Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants