Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add standalone directive support #23

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading