Skip to content

Commit

Permalink
Standalone components #9433
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerKiKi committed Jun 27, 2023
1 parent de7cea8 commit eb89b14
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 80 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ See the component in action on [the demo page](https://ecodev.github.io/fab-spee
```bash
yarn add @ecodev/fab-speed-dial
```
2. In `app.module.ts` add the following modules to the `imports` array:
- `MatButtonModule`
- `MatIconModule`
- `EcoFabSpeedDialModule`
2. In your standalone components add the following to the `imports` array:
- `EcoFabSpeedDialComponent`
- `EcoFabSpeedDialTriggerComponent`
- `EcoFabSpeedDialActionsComponent`

## Usage

Expand Down
7 changes: 0 additions & 7 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.module.spec.ts

This file was deleted.

14 changes: 0 additions & 14 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.module.ts

This file was deleted.

11 changes: 7 additions & 4 deletions projects/fab-speed-dial/src/lib/fab-speed-dial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import {TestBed} from '@angular/core/testing';

import {Direction, EcoFabSpeedDialActionsComponent, EcoFabSpeedDialComponent} from './fab-speed-dial';
import {
Direction,
EcoFabSpeedDialActionsComponent,
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
} from './fab-speed-dial';
import {By} from '@angular/platform-browser';
import {Component, ViewChild} from '@angular/core';
import {EcoFabSpeedDialModule} from '@ecodev/fab-speed-dial';

describe('FabSpeedDial', () => {
it('should apply direction class based on direction', () => {
Expand Down Expand Up @@ -136,7 +139,7 @@ describe('FabSpeedDial', () => {
</div>
`,
standalone: true,
imports: [EcoFabSpeedDialModule],
imports: [EcoFabSpeedDialActionsComponent, EcoFabSpeedDialTriggerComponent, EcoFabSpeedDialComponent],
})
class TestAppComponent {
@ViewChild(EcoFabSpeedDialActionsComponent)
Expand Down
2 changes: 0 additions & 2 deletions projects/fab-speed-dial/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ export {
Direction,
AnimationMode,
} from './lib/fab-speed-dial';

export {EcoFabSpeedDialModule} from './lib/fab-speed-dial.module';
5 changes: 1 addition & 4 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {MatTooltipModule} from '@angular/material/tooltip';
import {MatCardModule} from '@angular/material/card';

import {AppComponent} from './app.component';
import {EcoFabSpeedDialModule} from '@ecodev/fab-speed-dial';

describe('AppComponent', () => {
let component: AppComponent;
Expand All @@ -21,8 +20,6 @@ describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
EcoFabSpeedDialModule,

MatIconModule,
MatButtonModule,
MatButtonToggleModule,
Expand All @@ -34,8 +31,8 @@ describe('AppComponent', () => {
MatTooltipModule,
MatToolbarModule,
FormsModule,
AppComponent,
],
declarations: [AppComponent],
}).compileComponents();
fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
Expand Down
28 changes: 27 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
import {Component} from '@angular/core';
import {AnimationMode, Direction} from '@ecodev/fab-speed-dial';
import {
AnimationMode,
Direction,
EcoFabSpeedDialActionsComponent,
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
} from '@ecodev/fab-speed-dial';
import {MatIconModule} from '@angular/material/icon';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {FormsModule} from '@angular/forms';
import {MatRadioModule} from '@angular/material/radio';
import {MatCardModule} from '@angular/material/card';
import {MatButtonModule} from '@angular/material/button';
import {MatToolbarModule} from '@angular/material/toolbar';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: true,
imports: [
MatToolbarModule,
MatButtonModule,
MatCardModule,
MatRadioModule,
FormsModule,
MatSlideToggleModule,
MatIconModule,
EcoFabSpeedDialComponent,
EcoFabSpeedDialTriggerComponent,
EcoFabSpeedDialActionsComponent,
],
})
export class AppComponent {
private _fixed = false;
Expand Down
38 changes: 0 additions & 38 deletions src/app/app.module.ts

This file was deleted.

38 changes: 32 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {enableProdMode, importProvidersFrom} from '@angular/core';

import {AppModule} from './app/app.module';
import {environment} from './environments/environment';
import {AppComponent} from './app/app.component';
import {FormsModule} from '@angular/forms';
import {MatToolbarModule} from '@angular/material/toolbar';
import {MatTooltipModule} from '@angular/material/tooltip';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatCardModule} from '@angular/material/card';
import {MatRadioModule} from '@angular/material/radio';
import {MatInputModule} from '@angular/material/input';
import {MatButtonToggleModule} from '@angular/material/button-toggle';
import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
import {bootstrapApplication, BrowserModule} from '@angular/platform-browser';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.error(err));
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(
BrowserModule,
MatIconModule,
MatButtonModule,
MatButtonToggleModule,
MatInputModule,
MatRadioModule,
MatCardModule,
MatCheckboxModule,
MatSlideToggleModule,
MatTooltipModule,
MatToolbarModule,
FormsModule,
),
],
}).catch(err => console.error(err));

0 comments on commit eb89b14

Please sign in to comment.