Skip to content

Commit

Permalink
Merge pull request #23 from damingerdai/standalone-directive
Browse files Browse the repository at this point in the history
feat: add standalone directive support
  • Loading branch information
dkreider authored Nov 20, 2023
2 parents 680fccd + 808a633 commit 7d13119
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ jobs:
# that will run `ngcc` compiler accordingly.
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Test library
run: npm run test:ngx-loading-buttons

- name: Build library
run: npm run build:ngx-loading-buttons

- name: Build playground
run: npm run build
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build": "ng build ngx-loading-buttons-playground",
"build:ngx-loading-buttons": "ng-packagr -p projects/ngx-loading-buttons/ng-package.json && cd projects/ngx-loading-buttons && npm run build",
"test:ngx-loading-buttons": "ng test ngx-loading-buttons",
"watch": "ng build --watch --configuration development"
Expand Down Expand Up @@ -41,4 +41,4 @@
"ng-packagr": "^17.0.0",
"typescript": "~5.2.2"
}
}
}
Binary file modified projects/ngx-loading-buttons-playground/src/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ describe('MatBasicSpinnerDirective', () => {

beforeEach(() => {
fixture = TestBed.configureTestingModule({
declarations: [AppComponent, MatBasicSpinnerDirective]
imports: [
MatBasicSpinnerDirective
],
declarations: [AppComponent]
})
.createComponent(AppComponent);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Directive, HostBinding, Input } from '@angular/core';

@Directive({
selector: '[mtBasicSpinner]'
selector: '[mtBasicSpinner]',
standalone: true,
})
export class MatBasicSpinnerDirective {
@Input() hideText = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { AppComponent } from 'projects/ngx-loading-buttons-playground/src/app/ap
import { MatGlowDirective } from './mat-glow.directive';

describe('MatGlowDirective', () => {

let fixture: ComponentFixture<AppComponent>;

beforeEach(() => {
fixture = TestBed.configureTestingModule({
declarations: [AppComponent, MatGlowDirective]
imports: [
MatGlowDirective
],
declarations: [AppComponent]
})
.createComponent(AppComponent);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Directive, HostBinding, Input } from '@angular/core';

@Directive({
selector: '[mtGlow]'
selector: '[mtGlow]',
standalone: true,
})
export class MatGlowDirective {

@Input() glowColor: string = "blue";
@Input() mtGlow = false;
@Input() hideText = false;

@Input("class")
@Input("class")
@HostBinding('class')
get elementClass(): string {
document.documentElement.style.setProperty('--glow-color', this.glowColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { MatBasicSpinnerDirective } from './mat-basic-spinner.directive';
import { MatGlowDirective } from './mat-glow/mat-glow.directive';

@NgModule({
declarations: [
MatBasicSpinnerDirective,
MatGlowDirective
imports: [
MatGlowDirective,
MatBasicSpinnerDirective
],
exports: [
MatBasicSpinnerDirective,
Expand Down

0 comments on commit 7d13119

Please sign in to comment.