Skip to content

Commit 6b305fe

Browse files
committed
make it monorepo capable
1 parent 185a71e commit 6b305fe

20 files changed

+251
-67
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
# dependencies
1111
/node_modules
1212

13+
# firebase
14+
.firebaserc
15+
.firebase
16+
1317
# profiling files
1418
chrome-profiler-events*.json
1519
speed-measure-plugin*.json

projects/angular-keyboard/README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,37 @@
22

33
## Installation
44

5-
1. npm install @taskbase/angular-keyboard
6-
2. `import {AngularKeyboard} from '@taskbase/angular-keyboard'` and add to imports of your main AppModule.
7-
3. Wrap the whole app content in `app.component.html` with `<tb-keyboard-container>...</tb-keyboard-container>`
5+
1. npm install `@taskbase/angular-keyboard`
6+
2. Add `import {AngularKeyboard} from '@taskbase/angular-keyboard'` to your AppModule
7+
3. Configure the angular-keyboard in the module imports, something like this:
8+
```
9+
AngularKeyboardModule.forRoot({
10+
styles: {
11+
inputField: {
12+
'font-family': '"Palatino Linotype","Book Antiqua",Palatino,serif',
13+
'font-size': '120%',
14+
display: 'block',
15+
'line-height': '1.61',
16+
padding: '20px',
17+
'border-radius': '5px',
18+
background: '#f5f5f5',
19+
'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.05)',
20+
'text-align': 'left'
21+
},
22+
addedChar: {
23+
'font-weight': 'bold',
24+
color: 'blue'
25+
},
26+
removedChar: {
27+
color: 'lightblue',
28+
'text-decoration': 'line-through'
29+
}
30+
}
31+
}),
32+
```
33+
4. Wrap the whole app content in `app.component.html` with `<tb-keyboard-container>...</tb-keyboard-container>`
34+
35+
Note: If you only need the feature on some specific pages, you can also only load it there. Just make sure that the whole page content is wrapped.
836

937

1038
## Demo

src/app/app-routing.module.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
import { NgModule } from '@angular/core';
2-
import { Routes, RouterModule } from '@angular/router';
1+
import {NgModule} from '@angular/core';
2+
import {RouterModule, Routes} from '@angular/router';
33

4-
5-
const routes: Routes = [];
4+
const routes: Routes = [
5+
{
6+
path: 'keyboard',
7+
loadChildren: () => import('./keyboard-demo/keyboard-demo.module').then(mod => mod.KeyboardDemoModule)
8+
},
9+
{
10+
path: '',
11+
loadChildren: () => import('./home/home.module').then(mod => mod.HomeModule)
12+
}
13+
];
614

715
@NgModule({
816
imports: [RouterModule.forRoot(routes)],
917
exports: [RouterModule]
1018
})
11-
export class AppRoutingModule { }
19+
export class AppRoutingModule {
20+
}

src/app/app.component.html

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1 @@
1-
<tb-keyboard-container>
2-
<h1>Keyboard Demo</h1>
3-
<p>
4-
Click into the input field to open the keyboard.
5-
</p>
6-
<div style="width: 500px; max-width: 100%; margin: 0 auto;">
7-
<app-fake-input (text)="onTextChange($event)">
8-
</app-fake-input>
9-
</div>
10-
11-
<p>
12-
Here's a second input field with suggestion mode turned on.
13-
</p>
14-
<div style="width: 400px; max-width: 100%; margin: 0 auto;">
15-
<app-fake-input [suggestionMode]="true"
16-
(text)="onTextChange($event)">
17-
</app-fake-input>
18-
</div>
19-
20-
<p>
21-
You pressed <code>{{(input$ | async) || 'nothing yet'}}</code>.
22-
</p>
23-
</tb-keyboard-container>
241
<router-outlet></router-outlet>

src/app/app.component.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {Component, ViewChild} from '@angular/core';
2-
import {AngularKeyboardService} from '../../projects/angular-keyboard/src/lib/angular-keyboard.service';
1+
import {Component} from '@angular/core';
32

43
@Component({
54
selector: 'app-root',
@@ -8,15 +7,5 @@ import {AngularKeyboardService} from '../../projects/angular-keyboard/src/lib/an
87
})
98
export class AppComponent {
109

11-
input$ = this.keyboardService.input$;
12-
13-
constructor(
14-
private keyboardService: AngularKeyboardService
15-
) {
16-
}
17-
18-
onTextChange(text: string) {
19-
console.log(text);
20-
}
2110

2211
}

src/app/app.module.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {NgModule} from '@angular/core';
33

44
import {AppRoutingModule} from './app-routing.module';
55
import {AppComponent} from './app.component';
6-
import {AngularKeyboardModule} from '../../projects/angular-keyboard/src/lib/angular-keyboard.module';
76
import {FormsModule} from '@angular/forms';
87

98
@NgModule({
@@ -13,29 +12,6 @@ import {FormsModule} from '@angular/forms';
1312
imports: [
1413
BrowserModule,
1514
AppRoutingModule,
16-
AngularKeyboardModule.forRoot({
17-
styles: {
18-
inputField: {
19-
'font-family': '"Palatino Linotype","Book Antiqua",Palatino,serif',
20-
'font-size': '120%',
21-
display: 'block',
22-
'line-height': '1.61',
23-
padding: '20px',
24-
'border-radius': '5px',
25-
background: '#f5f5f5',
26-
'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.05)',
27-
'text-align': 'left'
28-
},
29-
addedChar: {
30-
'font-weight': 'bold',
31-
color: 'blue'
32-
},
33-
removedChar: {
34-
color: 'lightblue',
35-
'text-decoration': 'line-through'
36-
}
37-
}
38-
}),
3915
FormsModule
4016
],
4117
providers: [],
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
import {HomeComponent} from './home/home.component';
4+
5+
const routes: Routes = [{
6+
path: '', component: HomeComponent
7+
}];
8+
9+
@NgModule({
10+
imports: [RouterModule.forChild(routes)],
11+
exports: [RouterModule]
12+
})
13+
export class HomeRoutingModule { }

src/app/home/home.module.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {NgModule} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
4+
import {HomeRoutingModule} from './home-routing.module';
5+
import {HomeComponent} from './home/home.component';
6+
import {NavModule} from '../nav/nav.module';
7+
8+
@NgModule({
9+
declarations: [
10+
HomeComponent
11+
],
12+
imports: [
13+
CommonModule,
14+
HomeRoutingModule,
15+
NavModule
16+
]
17+
})
18+
export class HomeModule {
19+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<app-nav></app-nav>
2+
<p>
3+
Welcome to the taskbase-angular-libraries! Click the nav to view a demo.
4+
</p>

src/app/home/home/home.component.scss

Whitespace-only changes.

0 commit comments

Comments
 (0)