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 all icons in input containers the correct size #3489

Merged
merged 2 commits into from
Mar 10, 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
7 changes: 0 additions & 7 deletions src/demo-app/baseline/baseline-demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@
width: 100%;
}

.demo-icons {
font-size: 100%;
height: inherit;
vertical-align: top;
width: inherit;
}

.demo-card {
margin: 16px;
}
17 changes: 14 additions & 3 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
<td>
<md-input-container class="demo-full-width">
<input mdInput #postalCode maxLength="5" placeholder="Postal Code" value="94043">
<md-hint align="end">{{postalCode.value.length}} / 5</md-hint>
<md-hint align="end">
<md-icon>mode_edit</md-icon>
{{postalCode.value.length}} / 5
</md-hint>
</md-input-container>
</td>
</tr></table>
Expand All @@ -51,11 +54,19 @@
<md-card class="demo-card demo-basic">
<md-toolbar color="primary">Prefix + Suffix</md-toolbar>
<md-card-content>
<h4>Text</h4>
<md-input-container align="end">
<input mdInput placeholder="amount">
<span mdPrefix>$&nbsp;</span>
<span mdSuffix>.00</span>
</md-input-container>

<h4>Icons</h4>
<md-input-container>
<input mdInput placeholder="amount">
<md-icon mdPrefix>attach_money</md-icon>
<md-icon mdSuffix>mode_edit</md-icon>
</md-input-container>
</md-card-content>
</md-card>

Expand Down Expand Up @@ -152,10 +163,10 @@ <h4>Textarea</h4>
<md-input-container>
<input mdInput>
<md-placeholder>
I <md-icon class="demo-icons">favorite</md-icon> <b>bold</b> placeholder
I <md-icon>favorite</md-icon> <b>bold</b> placeholder
</md-placeholder>
<md-hint>
I also <md-icon class="demo-icons">home</md-icon> <i>italic</i> hint labels
I also <md-icon>home</md-icon> <i>italic</i> hint labels
</md-hint>
</md-input-container>
</p>
Expand Down
7 changes: 0 additions & 7 deletions src/demo-app/input/input-demo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@
width: 100%;
}

.demo-icons {
font-size: 100%;
height: inherit;
vertical-align: top;
width: inherit;
}

.demo-card {
margin: 16px;
}
Expand Down
16 changes: 8 additions & 8 deletions src/lib/input/input-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ $mat-input-underline-disabled-background-image:
[dir='rtl'] & {
text-align: right;
}

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

// Global wrapper. We need to apply margin to the element for spacing, but
Expand Down Expand Up @@ -238,12 +246,4 @@ $mat-input-underline-disabled-background-image:
// 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;
}
}