-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #398 from valor-software/development
refactor: created separate libraries for projects and blog
- Loading branch information
Showing
63 changed files
with
1,272 additions
and
917 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
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
75 changes: 75 additions & 0 deletions
75
libs/common-docs/src/directives/blog-portfolio/sort.directive.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,75 @@ | ||
import { | ||
Directive, | ||
Output, | ||
EventEmitter, Input | ||
} from '@angular/core'; | ||
import { IArticle, IPortfolio } from '../../models'; | ||
|
||
|
||
@Directive({ | ||
// eslint-disable-next-line @angular-eslint/directive-selector | ||
selector: '[sort]' | ||
}) | ||
export class SortDirective { | ||
_items?: IArticle[]; | ||
_activeItem: string[] = []; | ||
|
||
@Input() set activeItem(value: string[]) { | ||
this._items ? this.sortArticleItems(value) : this.sortProjectItems(value); | ||
}; | ||
|
||
@Input() projects?: IPortfolio[]; | ||
|
||
@Input() set articles(value: IArticle[]) { | ||
this._items = value; | ||
this.sortArticleItems(this._activeItem); | ||
}; | ||
|
||
@Output() changedProjects: EventEmitter<IPortfolio[]> = new EventEmitter(); | ||
|
||
@Output() changedArticles: EventEmitter<IArticle[]> = new EventEmitter(); | ||
|
||
sortProjectItems(value: string[]) { | ||
if (!value.length || value.includes('all_projects')) { | ||
this.changedProjects.emit(this.projects); | ||
return; | ||
} | ||
|
||
const files = new Set<IPortfolio>(); | ||
|
||
value.map(val => { | ||
let filterRes: IPortfolio[] | undefined = []; | ||
filterRes = this.projects?.filter((item: IPortfolio) => item.sortServices.includes(val)); | ||
if (filterRes?.length) { | ||
filterRes.map(item => files.add(item)); | ||
} | ||
}); | ||
this.changedProjects.emit([...files]); | ||
} | ||
|
||
|
||
sortArticleItems(value: string[]) { | ||
if (!value.length) { | ||
this.changedArticles.emit(this._items); | ||
return; | ||
} | ||
|
||
const files = new Set<IArticle>(); | ||
const lang = value.includes('pt') ? 'pt' : 'en'; | ||
const langFiles: IArticle[] | undefined = this._items?.filter((item: IArticle) => item.language === lang); | ||
if (value.length === 1 && langFiles?.length) { | ||
langFiles.map(item => files.add(item)); | ||
this.changedArticles.emit([...files]); | ||
return; | ||
} | ||
|
||
value.map(val => { | ||
let filterRes: IArticle[] | undefined = []; | ||
filterRes = langFiles?.filter((item: IArticle) => item.domains.includes(val)); | ||
if (filterRes?.length) { | ||
filterRes.map(item => files.add(item)); | ||
} | ||
}); | ||
this.changedArticles.emit([...files]); | ||
} | ||
} |
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 @@ | ||
export * from './blog-portfolio/sort.directive'; | ||
export * from './collapse-animations'; | ||
export * from './img-hover.directive'; | ||
export * from './showHide.directive'; |
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,3 @@ | ||
export * from './article.interface'; | ||
export * from './popover.interface'; | ||
export * from './portfolio.interface'; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.