From 3b8448369d5a0eb15ddc62c63696c006fa22d42e Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Thu, 12 Mar 2020 20:23:53 -0400 Subject: [PATCH] added bookmark design --- .../action-bar/action-bar.component.html | 55 ++++--------------- .../action-bar/action-bar.component.scss | 13 +++++ .../status/action-bar/action-bar.component.ts | 17 +++++- src/sass/_variables.scss | 1 + 4 files changed, 40 insertions(+), 46 deletions(-) diff --git a/src/app/components/stream/status/action-bar/action-bar.component.html b/src/app/components/stream/status/action-bar/action-bar.component.html index f783c925..d4f00bb1 100644 --- a/src/app/components/stream/status/action-bar/action-bar.component.html +++ b/src/app/components/stream/status/action-bar/action-bar.component.html @@ -11,7 +11,8 @@ - + @@ -19,6 +20,12 @@ + + + + + @@ -28,48 +35,6 @@ - - + \ No newline at end of file diff --git a/src/app/components/stream/status/action-bar/action-bar.component.scss b/src/app/components/stream/status/action-bar/action-bar.component.scss index e49a119d..0f1f22b9 100644 --- a/src/app/components/stream/status/action-bar/action-bar.component.scss +++ b/src/app/components/stream/status/action-bar/action-bar.component.scss @@ -34,6 +34,12 @@ &--fav { font-size: 17px; } + + &--bookmark { + position: relative; + // bottom: -1px; + font-size: 16px; + } &--cw { position: relative; @@ -86,6 +92,13 @@ } } +.bookmarked { + color: $bookmarked-color; + + &:hover { + color: darken($bookmarked-color, 10); + } +} @keyframes loadingAnimation { 0% { diff --git a/src/app/components/stream/status/action-bar/action-bar.component.ts b/src/app/components/stream/status/action-bar/action-bar.component.ts index 5b2f2f95..986f9727 100644 --- a/src/app/components/stream/status/action-bar/action-bar.component.ts +++ b/src/app/components/stream/status/action-bar/action-bar.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy, Input, Output, EventEmitter } from '@angu import { HttpErrorResponse } from '@angular/common/http'; import { Store } from '@ngxs/store'; import { Observable, Subscription } from 'rxjs'; -import { faWindowClose, faReply, faRetweet, faStar, faEllipsisH, faLock, faEnvelope } from "@fortawesome/free-solid-svg-icons"; +import { faWindowClose, faReply, faRetweet, faStar, faEllipsisH, faLock, faEnvelope, faBookmark } from "@fortawesome/free-solid-svg-icons"; import { faWindowClose as faWindowCloseRegular } from "@fortawesome/free-regular-svg-icons"; import { MastodonWrapperService } from '../../../../services/mastodon-wrapper.service'; @@ -27,6 +27,7 @@ export class ActionBarComponent implements OnInit, OnDestroy { faEllipsisH = faEllipsisH; faLock = faLock; faEnvelope = faEnvelope; + faBookmark = faBookmark; @Input() statusWrapper: StatusWrapper; @Output() replyEvent = new EventEmitter(); @@ -34,6 +35,7 @@ export class ActionBarComponent implements OnInit, OnDestroy { @Output() browseThreadEvent = new EventEmitter(); + isBookmarked: boolean; isFavorited: boolean; isBoosted: boolean; isDM: boolean; @@ -41,6 +43,7 @@ export class ActionBarComponent implements OnInit, OnDestroy { isBoostLocked: boolean; isLocked: boolean; + bookmarkingIsLoading: boolean; favoriteIsLoading: boolean; boostIsLoading: boolean; @@ -236,6 +239,18 @@ export class ActionBarComponent implements OnInit, OnDestroy { return false; } + bookmark(): boolean { + if (this.bookmarkingIsLoading) return; + + this.bookmarkingIsLoading = true; + setTimeout(() => { + this.isBookmarked = !this.isBookmarked; + this.bookmarkingIsLoading = false; + }, 2000); + + return false; + } + private checkIfBoosted() { const selectedAccount = this.selectedAccounts[0]; if (selectedAccount) { diff --git a/src/sass/_variables.scss b/src/sass/_variables.scss index 59a951ae..23905ab1 100644 --- a/src/sass/_variables.scss +++ b/src/sass/_variables.scss @@ -22,6 +22,7 @@ $status-secondary-color: #4e5572; $status-links-color: #d9e1e8; $boost-color : #5098eb; $favorite-color: #ffc16f; +$bookmarked-color: #ff5050; // Block dispositions $scroll-bar-width: 8px;