-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: added listing pages and masonary layout
- Loading branch information
1 parent
4a03158
commit ccdc0ba
Showing
32 changed files
with
795 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
export interface Author { | ||
username: string; | ||
name: string; | ||
profile_image_90: string; | ||
} | ||
|
||
export interface Listing { | ||
id: number; | ||
body_markdown: string; | ||
bumped_at: Date; | ||
category: string; | ||
contact_via_connect: boolean; | ||
expires_at?: any; | ||
originally_published_at: Date; | ||
location: string; | ||
processed_html: string; | ||
published: boolean; | ||
slug: string; | ||
title: string; | ||
user_id: number; | ||
tags: string[]; | ||
author: Author; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
export type Listings = Listings[]; |
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
36 changes: 36 additions & 0 deletions
36
src/app/pages/listings/contents/listing-card/listing-card.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,36 @@ | ||
<div class="listing-card"> | ||
<div class="listing-card-header"> | ||
<h2 class="listing-header-title"> | ||
<a href="">{{ listing.title }}</a> | ||
</h2> | ||
<time [attr.title]="listing.title" [attr.datetime]="listing.published"> | ||
{{ listing.bumped_at | date: "MMM d" }} | ||
</time> | ||
<div class="listing-tags"> | ||
<a | ||
class="listing-tag-link" | ||
href="" | ||
*ngFor="let tag of listing.tags; let i = index" | ||
> | ||
<span [class.negative-margin]="i === 0" class="listing-tag-prefix" | ||
>#</span | ||
>{{ tag }} | ||
</a> | ||
</div> | ||
</div> | ||
<div class="listing-card-body" [innerHTML]="listing.processed_html"> | ||
</div> | ||
<div class="author-details flex align-center"> | ||
<a class="author-profile" href=""> | ||
<img width="32" height="32" class="author-profile-img" [src]="listing.author.profile_image_90" alt=""> | ||
</a> | ||
<div class="author-name"> | ||
<a href="" class="author-name-link"> | ||
{{listing.author.name}} | ||
</a> | ||
<div class="listing-category"> | ||
<a href="">{{listing.category}}</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
115 changes: 115 additions & 0 deletions
115
src/app/pages/listings/contents/listing-card/listing-card.component.scss
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,115 @@ | ||
:host { | ||
border-radius: 5px; | ||
background: #fff; | ||
color: #08090a; | ||
box-shadow: 0 0 0 1px rgba(8, 9, 10, 0.1); | ||
overflow-wrap: anywhere; | ||
} | ||
.listing-card { | ||
position: relative; | ||
padding: 1rem; | ||
} | ||
.listing-header-title { | ||
padding-right: 48px; | ||
} | ||
|
||
.listing-header-title { | ||
line-height: 1.25; | ||
a:hover { | ||
color: #323ebe; | ||
} | ||
} | ||
::ng-deep .listing-card-body { | ||
p { | ||
margin: 0; | ||
word-break: break-word; | ||
} | ||
} | ||
.negative-margin { | ||
margin-left: -4px; | ||
} | ||
h2 { | ||
margin-top: 0; | ||
margin-bottom: 4px; | ||
} | ||
a { | ||
color: #202428; | ||
} | ||
.listing-card-header { | ||
margin-bottom: 12px; | ||
} | ||
time { | ||
color: #64707d; | ||
font-size: 0.85em; | ||
} | ||
.listing-card-body { | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.listing-category { | ||
line-height: 1.125rem; | ||
margin: 0; | ||
a { | ||
font-size: 0.75rem; | ||
color: #64707d; | ||
} | ||
} | ||
|
||
.author-name-link { | ||
font-weight: 500; | ||
font-size: 0.875rem; | ||
} | ||
|
||
.listing-tags { | ||
font-size: 0.875rem; | ||
} | ||
.listing-tag-link:hover { | ||
color: #08090a; | ||
} | ||
.listing-tag-link { | ||
padding: 4px; | ||
color: #64707d; | ||
display: inline-block; | ||
line-height: 1.3; | ||
border-radius: 5px; | ||
} | ||
.listing-tag-prefix { | ||
opacity: 0.4; | ||
font-weight: normal; | ||
} | ||
|
||
.author-profile { | ||
position: relative; | ||
} | ||
.author-profile::after { | ||
content: ""; | ||
border: 1px solid #08090a; | ||
opacity: 0.15; | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
border-radius: 100%; | ||
pointer-events: none; | ||
} | ||
|
||
.author-details { | ||
font-size: 0.875rem; | ||
gap: 8px; | ||
} | ||
.author-profile-img { | ||
border-radius: 100%; | ||
width: 100%; | ||
height: 100%; | ||
display: inline-block; | ||
vertical-align: bottom; | ||
} | ||
.author-profile { | ||
width: 2rem; | ||
display: inline-block; | ||
border-radius: 100%; | ||
position: relative; | ||
background-color: #64707d; | ||
height: 2rem; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/pages/listings/contents/listing-card/listing-card.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,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListingCardComponent } from './listing-card.component'; | ||
|
||
describe('ListingCardComponent', () => { | ||
let component: ListingCardComponent; | ||
let fixture: ComponentFixture<ListingCardComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ListingCardComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ListingCardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
src/app/pages/listings/contents/listing-card/listing-card.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,16 @@ | ||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { Listing } from 'src/app/models/Listings'; | ||
|
||
@Component({ | ||
selector: 'app-listing-card', | ||
templateUrl: './listing-card.component.html', | ||
styleUrls: ['./listing-card.component.scss'] | ||
}) | ||
export class ListingCardComponent implements OnInit { | ||
@Input() listing!:Listing; | ||
constructor() { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/app/pages/listings/contents/listings-content/listings-content.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,7 @@ | ||
<div class="listing-container"> | ||
<div class="l" appMasonary> | ||
<!-- <ng-container> --> | ||
<app-listing-card *ngFor="let listing of listingStore$|push" [attr.id]="listing.id" [listing]="listing" ></app-listing-card> | ||
<!-- </ng-container> --> | ||
</div> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
src/app/pages/listings/contents/listings-content/listings-content.component.scss
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,8 @@ | ||
.listing-container{ | ||
font-size: 16px; | ||
} | ||
.l{ | ||
display: grid; | ||
grid-gap: 1rem; | ||
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/pages/listings/contents/listings-content/listings-content.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,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListingsContentComponent } from './listings-content.component'; | ||
|
||
describe('ListingsContentComponent', () => { | ||
let component: ListingsContentComponent; | ||
let fixture: ComponentFixture<ListingsContentComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ListingsContentComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ListingsContentComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
src/app/pages/listings/contents/listings-content/listings-content.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,17 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ListingsStore } from '../service/listings-store'; | ||
|
||
@Component({ | ||
selector: 'app-listings-content', | ||
templateUrl: './listings-content.component.html', | ||
styleUrls: ['./listings-content.component.scss'] | ||
}) | ||
export class ListingsContentComponent implements OnInit { | ||
listingStore$ = this.listingsStore.listings$; | ||
|
||
constructor(private listingsStore:ListingsStore) { } | ||
|
||
ngOnInit(): void { | ||
} | ||
|
||
} |
Oops, something went wrong.