Skip to content

Commit 3852a90

Browse files
authored
Merge pull request #154 from scarraway/Textarea_directive
Add textarea directive and story. Fixes #153
2 parents 03366d5 + dfe15dd commit 3852a90

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

src/input/input.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Directive, HostBinding } from "@angular/core";
55
*
66
* Example:
77
*
8-
* ```hmtl
8+
* ```html
99
* <input ibmText/>
1010
* ```
1111
*

src/input/input.module.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ import { CommonModule } from "@angular/common";
66
// imports
77
import { LabelComponent } from "./label.component";
88
import { TextInput } from "./input.directive";
9+
import { TextArea } from "./text-area.directive";
910

1011
@NgModule({
1112
declarations: [
1213
LabelComponent,
13-
TextInput
14+
TextInput,
15+
TextArea
1416
],
1517
exports: [
1618
LabelComponent,
17-
TextInput
19+
TextInput,
20+
TextArea
1821
],
1922
imports: [
2023
CommonModule,

src/input/input.stories.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@ storiesOf("Input", module).addDecorator(
2222
template: `
2323
<input ibmText placeholder="Optional placeholder text"/>
2424
`
25+
})).add("TextArea", () => ({
26+
template: `
27+
<textarea ibmTextArea placeholder="Optional placeholder text" rows="4" cols="50"></textarea>
28+
`
2529
}));

src/input/text-area.directive.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Directive, HostBinding } from "@angular/core";
2+
3+
/**
4+
* A directive for applying styling to a textarea element.
5+
*
6+
* Example:
7+
*
8+
* ```html
9+
* <textarea ibmTextArea></textarea>
10+
* ```
11+
*
12+
* See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.
13+
*/
14+
@Directive({
15+
selector: "[ibmTextArea]"
16+
})
17+
export class TextArea {
18+
@HostBinding("class.bx--text-area") baseClass = true;
19+
}

0 commit comments

Comments
 (0)