diff --git a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.html b/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.html index 33237f3bf..48a8528c2 100644 --- a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.html +++ b/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.html @@ -1 +1,7 @@ -
+
+
+ + + +
+
diff --git a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.scss b/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.scss deleted file mode 100644 index af1a47de2..000000000 --- a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.issue { - padding: 1rem; -} diff --git a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.ts b/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.ts index 82a070057..385673344 100644 --- a/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.ts +++ b/angular-ngrx-scss/src/app/issues/components/issues-list/issues-list.component.ts @@ -1,8 +1,10 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; +import { Issue } from 'src/app/repository/services/repository.interfaces'; @Component({ selector: 'app-issues-list', templateUrl: './issues-list.component.html', - styleUrls: ['./issues-list.component.scss'], }) -export class IssuesListComponent {} +export class IssuesListComponent { + @Input() issues: Issue[] = []; +} diff --git a/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.html b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.html new file mode 100644 index 000000000..a909aa593 --- /dev/null +++ b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.html @@ -0,0 +1,46 @@ +
+
+
+ + + + + + + + +
+
+ {{ item.title }} + + + {{ label.name }} + + +
+
+ #{{ item.number }} + + opened + {{ item.created_at | relativeTime }} + + by + {{ item.user.login }} + + was closed + {{ item.closed_at! | relativeTime }} + +
+
+
+
+ + + {{ item.comments }} + +
+
+
diff --git a/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.scss b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.scss new file mode 100644 index 000000000..22a6a05eb --- /dev/null +++ b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.scss @@ -0,0 +1,76 @@ +@use '../../styles/variables.scss'; + +$color-open: variables.$green100; +$color-closed: variables.$purple100; + +.item { + padding: 1.125rem; + border-bottom: 1px solid variables.$gray200; + + &:hover { + background-color: variables.$gray100; + } +} + +.item-container { + display: flex; + justify-content: space-between; + align-items: center; + + .info { + display: flex; + } + + .comments { + display: flex; + flex-direction: column; + } +} + +.icon { + margin-right: 0.5rem; + + &.open { + color: $color-open; + } + + &.closed { + color: $color-closed; + } +} + +.content { + .title { + font-size: 1.125rem; + font-weight: 600; + margin-right: 0.25rem; + + &:hover { + color: variables.$blue300; + } + } + + .label { + font-weight: 500; + font-size: 0.875rem; + margin: 0 0.385rem; + padding: 0.125rem 0.5rem; + cursor: pointer; + border-radius: 0.875rem; + } +} + +.meta { + line-height: 0.875rem; + font-size: 0.875rem; + margin-top: 0.325rem; + color: variables.$gray600; + + .created-by { + cursor: pointer; + + &:hover { + color: variables.$blue300; + } + } +} diff --git a/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.ts b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.ts new file mode 100644 index 000000000..cd22264ef --- /dev/null +++ b/angular-ngrx-scss/src/app/shared/components/repo-issue-pull-card/repo-issue-pull-card.component.ts @@ -0,0 +1,20 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { Issue } from 'src/app/repository/services/repository.interfaces'; + +@Component({ + selector: 'app-repo-issue-pull-card', + templateUrl: './repo-issue-pull-card.component.html', + styleUrls: ['./repo-issue-pull-card.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class RepoIssuePullCardComponent { + @Input() item?: Issue; + + get isOpen(): boolean { + return this.item?.state === 'open'; + } + + colorMap(color: string): string { + return `#${color}`; + } +} diff --git a/angular-ngrx-scss/src/app/shared/shared.module.ts b/angular-ngrx-scss/src/app/shared/shared.module.ts index 466cba161..8e90a3873 100644 --- a/angular-ngrx-scss/src/app/shared/shared.module.ts +++ b/angular-ngrx-scss/src/app/shared/shared.module.ts @@ -7,6 +7,7 @@ import { OcticonsDirective } from './directives/octicons.directive'; import { FilterDropdownComponent } from './components/filter-dropdown/filter-dropdown.component'; import { MarkdownPipe } from './pipes/markdown.pipe'; import { PaginationComponent } from './components/pagination/pagination.component'; +import { RepoIssuePullCardComponent } from './components/repo-issue-pull-card/repo-issue-pull-card.component'; @NgModule({ declarations: [ @@ -16,6 +17,7 @@ import { PaginationComponent } from './components/pagination/pagination.componen OcticonsDirective, FilterDropdownComponent, PaginationComponent, + RepoIssuePullCardComponent, ], imports: [CommonModule, RouterModule], exports: [ @@ -25,6 +27,7 @@ import { PaginationComponent } from './components/pagination/pagination.componen OcticonsDirective, FilterDropdownComponent, PaginationComponent, + RepoIssuePullCardComponent, ], }) export class SharedModule {} diff --git a/angular-ngrx-scss/src/app/shared/styles/variables.scss b/angular-ngrx-scss/src/app/shared/styles/variables.scss index fa36acf91..bff7983ef 100644 --- a/angular-ngrx-scss/src/app/shared/styles/variables.scss +++ b/angular-ngrx-scss/src/app/shared/styles/variables.scss @@ -15,6 +15,8 @@ $blue100: rgb(219, 234, 254); $blue300: rgb(59, 130, 246); $blue400: rgb(96, 165, 250); $blue600: rgb(37 99 235); +$green100: rgb(5, 150, 105); +$purple100: rgb(124, 58, 237); // breakpoints $sm: 640px;