starting styling status

This commit is contained in:
Nicolas Constant 2018-09-19 01:03:07 -04:00
parent e1108e1872
commit 94360278ad
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
7 changed files with 103 additions and 70 deletions

View File

@ -1,5 +1,9 @@
<div class="toot">
<img class="toot__avatar" src="{{ status.account.avatar }}" />
<a href class="toot__profile-link"><span class="toot__fullname" innerHTML="{{status.account.display_name}}"></span> @<span id="toot-username" innerHTML="{{status.account.username}}"></span></a>
<div class="toot__content" innerHTML="{{status.content}}"></div>
</div>
<div class="status">
<a href class="status__profile-link" title="{{status.account.acct}}">
<img class="status__avatar" src="{{ status.account.avatar }}" />
<span class="status__fullname" innerHTML="{{status.account.display_name}}"></span>
@<span id="status-username">{{status.account.acct}}</span>
</a>
<div class="status__created-at" title="{{ status.created_at | date: 'long' }}">{{ getCompactRelativeTime(status.created_at) }}</div>
<div class="status__content" innerHTML="{{status.content}}"></div>
</div>

View File

@ -1,47 +1,56 @@
.toot {
border: solid #06070b;
border-width: 0 0 1px 0;
@import "variables";
.status {
margin: 0;
padding: 0;
width: calc(100%);
min-height: 70px;
overflow: hidden;
position: relative;
&__avatar {
margin: 10px 0 0 10px;
position: absolute;
top: 10px;
left: 10px; // margin: 10px 0 0 10px;
/* margin: 0; */
width: 50px;
height: 50px;
float: left;
height: 50px; // float: left;
border-radius: 2px;
}
&__fullname {
color: white;
display: block;
color: $status-primary-color;
}
&__profile-link {
color: #353e64;
color: $status-secondary-color;
margin: 7px 0 0 70px;
display: block;
text-decoration: none;
overflow: hidden;
}
&__content {
/*width: calc(100% - 50px);*/
margin: 10px 10px 10px 70px;
margin: 0px 10px 10px 70px;
}
&__content p {
margin: 0;
font-size: 0.85em;
}
&__created-at {
color: $status-secondary-color;
position: absolute;
top: 5px;
right: 10px;
}
}
// #toot-avatar img {
// width: 50px;
// height: 50px;
// border-radius: 2px;
// margin: 0;
// }
/* #toot-username {
color: grey;
} */
/* ::ng-deep .invisible {
display: inline;
color: red;
} */
//Mastodon styling
:host ::ng-deep .status__content {
color: $status-primary-color;
& a,
.mention,
.ellipsis {
color: $status-links-color;
}
& .invisible {
display: none;
}
}

View File

@ -1,18 +1,34 @@
import { Component, OnInit, Input } from "@angular/core";
import { Component, OnInit, Input, Inject, LOCALE_ID } from "@angular/core";
import { Status } from "../../../services/models/mastodon.interfaces";
import { formatDate } from '@angular/common';
@Component({
selector: "app-status",
templateUrl: "./status.component.html",
styleUrls: ["./status.component.scss"]
selector: "app-status",
templateUrl: "./status.component.html",
styleUrls: ["./status.component.scss"]
})
export class StatusComponent implements OnInit {
@Input() status: Status;
@Input() status: Status;
constructor() { }
constructor(@Inject(LOCALE_ID) private locale: string) { }
ngOnInit() {
}
ngOnInit() {
}
getCompactRelativeTime(d: string): string {
const date = (new Date(d)).getTime();
const now = Date.now();
const timeDelta = (now - date) / (1000 * 60);
if (timeDelta < 60) {
return `${timeDelta | 0}m`;
} else if (timeDelta < 60 * 24) {
return `${timeDelta / 60 | 0}h`;
} else if (timeDelta < 60 * 24 * 31) {
return `${timeDelta / (60 * 24) | 0}d`;
}
return formatDate(date, 'MM/dd', this.locale);
}
}

View File

@ -3,7 +3,7 @@
<a href title="return to top" (click)="goToTop()"><h1>{{ streamElement.name.toUpperCase() }}</h1></a>
</div>
<div class="stream-toots flexcroll" #statusstream (scroll)="onScroll()"> <!-- data-simplebar -->
<div *ngFor="let status of statuses">
<div class="stream-toots__status" *ngFor="let status of statuses">
<app-status [status]="status" ></app-status>
</div>
</div>

View File

@ -1,33 +1,32 @@
@import "variables";
.stream-column {
width: $stream-column-width;
height: calc(100%);
background-color: #0f111a;
margin: 0 0 0 $stream-column-separator;
&__stream-header {
width: calc(100%);
height: 30px;
background-color: black;
border-bottom: 1px solid black;
& h1 {
color: whitesmoke;
font-size: 0.8em;
font-weight: normal;
margin: 0;
padding: 8px 0 0 10px;
width: $stream-column-width;
height: calc(100%);
background-color: #0f111a;
margin: 0 0 0 $stream-column-separator;
&__stream-header {
width: calc(100%);
height: 30px;
background-color: black;
border-bottom: 1px solid black;
& h1 {
color: whitesmoke;
font-size: 0.8em;
font-weight: normal;
margin: 0;
padding: 8px 0 0 10px;
}
}
}
}
.stream-toots {
height: calc(100% - 30px);
width: 320px;
overflow: auto;
height: calc(100% - 30px);
width: 320px;
overflow: auto;
&__status:not(:last-child) {
border: solid #06070b;
border-width: 0 0 1px 0;
}
}
.flexcroll {

View File

@ -10,6 +10,11 @@ $color-secondary: #090b10;
$default-font-size: 15px;
$small-font-size: 12px;
$status-primary-color: #fff;
$status-secondary-color: #353e64;
$status-secondary-color: #4e5572;
$status-links-color: #d9e1e8;
// Block dispositions
$stream-selector-height: 30px;

View File

@ -28,16 +28,16 @@ html, body {
background-color: $color-primary;
}
.invisible {
display: none;
}
// .invisible {
// display: none;
// }
/* .ellipsis {
} */
#toot-content p {
margin-bottom: 0 !important;
}
// #toot-content p {
// margin-bottom: 0 !important;
// }
#toot-content a {
color: #bec3d8;
}
// #toot-content a {
// color: #bec3d8;
// }