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

fix(input): make icons in prefix/suffix the right size #3342

Merged
merged 1 commit into from
Mar 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,8 @@ <h4>Textarea</h4>
Both:
<md-input-container align="end">
<input mdInput #email placeholder="Email Address" value="angular-core">
<span mdPrefix>
<md-icon [class.primary]="email.focused" class="demo-icons demo-transform">email</md-icon>
&nbsp;
</span>
<span mdSuffix class="demo-transform" [class.primary]="email.focused">
&nbsp;@gmail.com
</span>
<span mdPrefix><md-icon [class.primary]="email.focused">email</md-icon>&nbsp;</span>
<span mdSuffix [class.primary]="email.focused">&nbsp;@gmail.com</span>
</md-input-container>
</p>

Expand Down
10 changes: 9 additions & 1 deletion src/lib/input/input-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,16 @@ $mat-input-underline-disabled-background-image:
}
}

// Prevents the prefix and suffix from stretching together with the container.
.mat-input-prefix, .mat-input-suffix {
// Prevents the prefix and suffix from stretching together with the container.
width: 0.1px;
white-space: nowrap;

// Allow icons in a prefix/suffix to adapt to the correct size.
& .mat-icon {
width: auto;
height: auto;
font-size: 100%;
vertical-align: top;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why do we use vertical-align top here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was part of the styles that were already in the demo app css that i was migrating into the library css. I'm not sure on the original rationale for top, but leaving it as baseline causes the prefix/suffix element to be too tall, bottom and middle also fix the issue but I just left top since that was in the demo css already.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

}
}