Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 14
feat(angular-ngrx-scss): Create main layout (Top repos + Gists)#319
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
285d37d27c7bb6262719677234b36a5a3e5bf00576d16ebb6608fa15File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| <div class="top-repositories-container"> | ||
| <h2>Top Repositories</h2> | ||
| <div class="repo-container"> | ||
| <ng-container *ngIf="repos$ | async as repos"> | ||
| <ng-container *ngFor="let repo of repos; last as isLast"> | ||
| <div class="repo-section"> | ||
| <app-repo-card [repo]="repo"></app-repo-card> | ||
| </div> | ||
| <div class="view-all-link" *ngIf="isLast"> | ||
| <ng-container *ngIf="username$ | async as username"> | ||
| <a routerLink="/{{ username }}" [class.disabled]="!username" | ||
| >View all repositories</a | ||
| > | ||
| </ng-container> | ||
| </div> | ||
| </ng-container> | ||
| </ng-container> | ||
| </div> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @use '../../shared/styles/variables'; | ||
| .top-repositories-container { | ||
| padding: 3rem; | ||
| h2 { | ||
| font-size: 18px; | ||
| line-height: 28px; | ||
lindakatcodes marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| font-weight: 500; | ||
| margin-bottom: 16px; | ||
| } | ||
| .repo-container { | ||
| background-color: variables.$white; | ||
| border-radius: 0.5rem; | ||
| border-width: 1px; | ||
| } | ||
| .repo-section { | ||
lindakatcodes marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| padding: 2rem 0; | ||
| padding-left: 2rem; | ||
| border-bottom: 1px solid variables.$gray300; | ||
| } | ||
| .view-all-link { | ||
| padding: 1.25rem; | ||
| background-color: variables.$gray200; | ||
| display: grid; | ||
| place-items: center; | ||
| a { | ||
| color: inherit; | ||
| font-weight: 600; | ||
| &.disabled { | ||
| color: variables.$gray300; | ||
| cursor: not-allowed; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { Store } from '@ngrx/store'; | ||
| import { selectTopRepos, selectUserLoginName } from 'src/app/state/user'; | ||
| @Component({ | ||
| selector: 'app-top-repositories', | ||
| templateUrl: './top-repositories.component.html', | ||
| styleUrls: ['./top-repositories.component.scss'], | ||
| }) | ||
| export class TopRepositoriesComponent { | ||
| username$ = this.store.select(selectUserLoginName); | ||
| repos$ = this.store.select(selectTopRepos); | ||
| constructor(private store: Store) {} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <div class="container"> | ||
| <h3>Gists</h3> | ||
| <ng-container *ngIf="userGists$ | async as gists"> | ||
| <ng-container *ngIf="gists.length > 0"> | ||
| <div class="list-container"> | ||
lindakatcodes marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| <ng-container *ngFor="let gist of gists"> | ||
| <a class="link" [href]="gist.url" target="_blank">{{ | ||
| gist.fileName | ||
| }}</a> | ||
lindakatcodes marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| </ng-container> | ||
| </div> | ||
| </ng-container> | ||
| </ng-container> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| @use '../../shared/styles/variables'; | ||
| .container { | ||
| padding: 2rem 0; | ||
| border-top: 1px solid variables.$gray300; | ||
| border-bottom: 1px solid variables.$gray300; | ||
| h3 { | ||
| font-weight: 600; | ||
| } | ||
| a.link { | ||
| color: variables.$black; | ||
| &:hover { | ||
| color: variables.$blue300; | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { Store } from '@ngrx/store'; | ||
| import { selectGists } from 'src/app/state/user'; | ||
| @Component({ | ||
| selector: 'app-user-gists', | ||
| templateUrl: './user-gists.component.html', | ||
| styleUrls: ['./user-gists.component.scss'], | ||
| }) | ||
| export class UserGistsComponent { | ||
| userGists$ = this.store.select(selectGists); | ||
| constructor(private store: Store) {} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4,8 +4,36 @@ export interface ProfileState { | ||
| user?: UserState; | ||
| orgs?: UserOrgsState[]; | ||
| repos?: UserReposState[]; | ||
| gists?: UserGistsState[]; | ||
| } | ||
| export interface UserGistsState { | ||
| url: string; | ||
| fileName: string; | ||
| } | ||
| interface Files { | ||
| [key: string]: { filename: string }; | ||
| } | ||
| export interface UserGist { | ||
| comments: number; | ||
| comments_url: string; | ||
| commits_url: string; | ||
| created_at: string; | ||
| forks_url: string; | ||
| git_pull_url: string; | ||
| git_push_url: string; | ||
| html_url: string; | ||
| id: string; | ||
| node_id: string; | ||
| public: boolean; | ||
| truncated: false; | ||
| updated_at: string; | ||
| url: string; | ||
| files: Files; | ||
| } | ||
| export type UserGistsApiResponse = UserGist[]; | ||
lindakatcodes marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| export interface UserOrgsState { | ||
| id: number; | ||
| login: string; | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.