-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(list): change the provider for list service
- Loading branch information
patrickjahr
committed
Apr 16, 2024
1 parent
63fc4da
commit 54b129b
Showing
14 changed files
with
72 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
libs/sketch/src/lib/components/list/components/list-collection/list-collection.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
} |
1 change: 1 addition & 0 deletions
1
.../sketch/src/lib/components/list/components/list-collection/list-collection.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ng-content></ng-content> |
21 changes: 21 additions & 0 deletions
21
...etch/src/lib/components/list/components/list-collection/list-collection.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { ListCollectionComponent } from './list-collection.component'; | ||
|
||
describe('ListComponent', () => { | ||
let component: ListCollectionComponent; | ||
let fixture: ComponentFixture<ListCollectionComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ListCollectionComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ListCollectionComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
libs/sketch/src/lib/components/list/components/list-collection/list-collection.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component, output, signal, ViewEncapsulation } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ListItemComponent } from '../list-item/list-item.component'; | ||
|
||
@Component({ | ||
selector: 'sk-list-collection', | ||
standalone: true, | ||
imports: [CommonModule, ListItemComponent], | ||
templateUrl: './list-collection.component.html', | ||
styleUrl: './list-collection.component.css', | ||
encapsulation: ViewEncapsulation.ShadowDom, | ||
}) | ||
export class ListCollectionComponent { | ||
private readonly activeItemId = signal<string | undefined>(undefined); | ||
activeIdChanged = output<string>(); | ||
|
||
activateItem(id: string): void { | ||
this.activeItemId.update(() => id); | ||
this.activeIdChanged.emit(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './list.component'; | ||
export * from './components/list-collection/list-collection.component'; | ||
export * from './components/list-item/list-item.component'; | ||
export * from './directives/list-item-active.directive'; | ||
export * from './services/list.service'; | ||
export * from './list.component'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +0,0 @@ | ||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,13 @@ | ||
import { Component, output, signal, ViewEncapsulation } from '@angular/core'; | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ListItemComponent } from './components/list-item/list-item.component'; | ||
import { ListService } from './services/list.service'; | ||
|
||
@Component({ | ||
selector: 'sk-list', | ||
standalone: true, | ||
imports: [CommonModule, ListItemComponent], | ||
imports: [CommonModule], | ||
providers: [ListService], | ||
templateUrl: './list.component.html', | ||
styleUrl: './list.component.css', | ||
encapsulation: ViewEncapsulation.ShadowDom, | ||
}) | ||
export class ListComponent { | ||
private readonly activeItemId = signal<string | undefined>(undefined); | ||
activeIdChanged = output<string>(); | ||
|
||
activateItem(id: string): void { | ||
this.activeItemId.update(() => id); | ||
this.activeIdChanged.emit(id); | ||
} | ||
} | ||
export class ListComponent {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters