Skip to content

Commit ab51f97

Browse files
committed
feat(input): add basic input directive
1 parent 44d2f2c commit ab51f97

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/input/input.directive.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Directive, Input, HostBinding } from "@angular/core";
2+
3+
@Directive({
4+
selector: "[ibmText]"
5+
})
6+
export class TextInput {
7+
@HostBinding("class") inputClass = "bx--text-input";
8+
}

src/input/input.module.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ import { FormsModule } from "@angular/forms";
44
import { CommonModule } from "@angular/common";
55

66
// imports
7-
import { LabelComponent } from "../input/label.component";
8-
9-
// exports
10-
export { LabelComponent } from "../input/label.component";
7+
import { LabelComponent } from "./label.component";
8+
import { TextInput } from "./input.directive";
119

1210
@NgModule({
1311
declarations: [
14-
LabelComponent
12+
LabelComponent,
13+
TextInput
1514
],
1615
exports: [
17-
LabelComponent
16+
LabelComponent,
17+
TextInput
1818
],
1919
imports: [
2020
CommonModule,
2121
FormsModule,
2222
]
2323
})
24-
export class InputModule { }
24+
class InputModule { }
25+
26+
export { TextInput, LabelComponent, InputModule };

src/input/input.stories.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ storiesOf("Input", module).addDecorator(
1717
<input type="text" class="bx--text-input" placeholder="Optional placeholder text">
1818
</ibm-label>
1919
`
20+
}))
21+
.add("Input", () => ({
22+
template: `
23+
<input ibmText/>
24+
`
2025
}));

0 commit comments

Comments
 (0)