Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
docs(text-field): Add density() mixin examples (#2202)
Browse files Browse the repository at this point in the history
closes #2177
  • Loading branch information
trimox authored Apr 15, 2020
1 parent b153372 commit 751dab5
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 16 deletions.
45 changes: 29 additions & 16 deletions demos/src/app/components/text-field/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,22 @@ <h3 class="demo-content__headline">Svg Icon</h3>
<example-viewer [example]="exampleSvgIcon"></example-viewer>
</div>

<div class="demo-content">
<h3 class="demo-content__headline">Density</h3>
<div class="demo-container">
<mdc-text-field class="demo-density-text-field" label="Density"></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field class="demo-density-outlined-text-field" outlined label="Density"></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field class="demo-density-outlined-text-field-with-leading-icon" outlined label="Event date">
<mdc-icon mdcTextFieldIcon leading>event</mdc-icon>
</mdc-text-field>
</div>
<example-viewer [example]="exampleDensity"></example-viewer>
</div>

<div class="demo-content">
<h3 class="demo-content__headline">Shape</h3>
<div class="demo-container">
Expand Down Expand Up @@ -287,23 +303,20 @@ <h3 class="demo-content__headline">RTL</h3>

<div class="demo-content">
<h3 class="demo-content__headline">Date / Time / Color / Password</h3>
<div class="demo-layout__row">
<div class="demo-container">
<mdc-text-field type="date" label="Birthday" outlined></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="time" label="Time" outlined></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="password" label="Password" required outlined>
</mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="color" label="Color" style="width: 6rem" outlined>
</mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="date" label="Birthday" outlined></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="time" label="Time" outlined></mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="password" label="Password" required outlined>
</mdc-text-field>
</div>
<div class="demo-container">
<mdc-text-field type="color" label="Color" style="width: 6rem" outlined>
</mdc-text-field>
</div>

<example-viewer [example]="exampleDateTime"></example-viewer>
</div>

Expand Down
9 changes: 9 additions & 0 deletions demos/src/app/components/text-field/text-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ resetForm(formDirective: FormGroupDirective) {
ts: `demoInputValue: string;`
};

exampleDensity = {
html: `<mdc-text-field class="demo-density-text-field" label="Density"></mdc-text-field>
<mdc-text-field class="demo-density-outlined-text-field" outlined label="Density"></mdc-text-field>
<mdc-text-field class="demo-density-outlined-text-field-with-leading-icon" outlined label="Event date">
<mdc-icon mdcTextFieldIcon leading>event</mdc-icon>
</mdc-text-field>`,
sass: `https://raw.githubusercontent.com/trimox/angular-mdc-web/master/demos/src/styles/_text-field.scss`
};

exampleIcons = {
html: `<mdc-text-field autocomplete="tel" type="tel" label="Phone number">
<mdc-icon mdcTextFieldIcon leading>phone</mdc-icon>
Expand Down
16 changes: 16 additions & 0 deletions demos/src/styles/_text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@
@include textfield.outline-shape-radius(50%);
}

//
// Density
//

.demo-density-text-field {
@include textfield.density(-1);
}

.demo-density-outlined-text-field {
@include textfield.outlined-density(-3);
}

.demo-density-outlined-text-field-with-leading-icon {
@include textfield.outlined-with-leading-icon-density(-3);
}

//
// Form spacing
//
Expand Down

0 comments on commit 751dab5

Please sign in to comment.