File

src/app/components/collection-acions/collection-acions.component.ts

Metadata

Index

Properties
Methods
Inputs
Outputs

Constructor

constructor(commonUtil: CommonUtilService)
Parameters :
Name Type Optional
commonUtil CommonUtilService No

Inputs

contentDetail
Type : Content
isDepthChild
Type : boolean
showDownloadBtn
Type : boolean
trackDownloads
Type : Observable<DownloadTracking>

Outputs

downloadAllContent
Type : EventEmitter
shareEvent
Type : EventEmitter
showOverflowMenuEvent
Type : EventEmitter

Methods

downloadAllContents
downloadAllContents()
Returns : void
share
share()
Returns : void
showOverflowMenu
showOverflowMenu()
Returns : void

Properties

Public commonUtil
Type : CommonUtilService
text
Type : string
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Content, DownloadTracking } from 'sunbird-sdk';
import { CommonUtilService } from '@app/services';
import { Observable } from 'rxjs';

@Component({
  selector: 'collection-acions',
  templateUrl: './collection-acions.component.html',
  styleUrls: ['../detail-card/detail-card.component.scss'],
})
export class CollectionActionsComponent {
  @Input() contentDetail: Content;
  @Input() showDownloadBtn: boolean;
  @Input() isDepthChild: boolean;
  @Input() trackDownloads: Observable<DownloadTracking>;

  @Output() downloadAllContent = new EventEmitter();
  @Output() showOverflowMenuEvent = new EventEmitter();
  @Output() shareEvent = new EventEmitter();
  text: string;

  constructor(public commonUtil: CommonUtilService) {}

  downloadAllContents() {
    this.downloadAllContent.emit();
  }

  showOverflowMenu() {
    this.showOverflowMenuEvent.emit();
  }

  share() {
    this.shareEvent.emit();
  }
}

<div class="sb-dt-card">
  <div class="sb-dt-card-actions">
    <div class="sb-btn-tile-group">
      <ng-container *ngIf="trackDownloads | async; let downloads">
        <button class="sb-btn-tile" *ngIf="showDownloadBtn && !isDepthChild" [disabled]="downloads.queued.length"
          (click)="downloadAllContents()">
          <ion-icon name="cloud-download" class="sb-dt-card-blue-icon"></ion-icon>
          <span *ngIf="!downloads.queued.length" class="sb-btn-footer-text">{{ 'DOWNLOAD' | translate }}</span>
          <span *ngIf="downloads.queued.length" class="btn-popover-progress-container">
            <span class="btn-progress-highlight" [ngStyle]="{'width': (downloads.completed.length/(downloads.queued.length+downloads.completed.length))*100 + '%'}">
            </span>
          </span>
        </button>
        <button class="sb-btn-tile" *ngIf="contentDetail?.isAvailableLocally" [disabled]="downloads.queued.length" (click)="showOverflowMenu($event)">
          <ion-icon name="trash" class="sb-dt-card-danger-icon"></ion-icon>
          <span class="sb-btn-footer-text">{{ 'REMOVE' | translate }}</span>
        </button>
        <button class="sb-btn-tile" (click)="share()">
          <ion-icon name="share" class="sb-dt-card-blue-icon"></ion-icon>
          <span class="sb-btn-footer-text">{{ 'SHARE' | translate }}</span>
        </button>
      </ng-container>
    </div>
  </div>
</div>

../detail-card/detail-card.component.scss

@import "src/assets/styles/base/_variables.scss";
:host {

    .btn-progress-highlight{
        left: 0px;
        background: $primary-800;
        height: 0.313rem;
        position: absolute;
        border-radius: inherit;
        border: 0px;
    }

    .btn-popover-progress-container{
        position: relative;
        border-radius: 33px;
        display: inline-block;
        background: $primary-200;
        height: 0.313rem;
        width: 3.5rem;
    }

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""