fix(dashboard): improve rooms selector and player responsiveness

This commit is contained in:
KostyaDanovsky 2017-09-12 19:22:10 +03:00
parent 754c148e69
commit a77a1c3c70
7 changed files with 197 additions and 185 deletions

View file

@ -34,13 +34,13 @@
<div class="footer">
<div class="volume">
<i class="nb-volume-mute quiet"></i>
<i class="nb-volume-mute"></i>
<div class="progress-wrap">
<input type="range" class="progress" [value]="getVolume()" max="100"
(input)="setVolume(volume.value)" #volume>
<div class="progress-foreground" [style.width.%]="getVolume()"></div>
</div>
<i class="nb-volume-high loud"></i>
<i class="nb-volume-high"></i>
</div>
</div>

View file

@ -1,4 +1,4 @@
@import '../../../@theme/styles/themes';
@import '../../../../@theme/styles/themes';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/components/card/card.component.theme';
@import '~@nebular/theme/styles/global/bootstrap/breakpoints';
@ -118,7 +118,7 @@
}
.shuffle, .loop {
font-size: 1.25rem;
font-size: 1.5rem;
color: nb-theme(color-fg);
&.active {
@ -135,10 +135,7 @@
height: 3.5rem;
border: 2px solid nb-theme(separator);
border-radius: 50%;
&::before {
font-size: 1.25rem;
}
font-size: 1.75rem;
}
.play {
@ -150,9 +147,15 @@
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 1.25rem;
margin: 0;
position: relative;
i {
font-size: 1.5rem;
margin: 0.25rem;
color: nb-theme(color-fg);
}
.progress-wrap {
height: 2.25rem;
margin: 0;
@ -178,30 +181,6 @@
}
}
}
.quite, .loud {
color: nb-theme(color-fg);
}
.quite {
font-size: 1.25rem;
}
.loud {
font-size: 1.5rem;
}
}
@include media-breakpoint-down(xl) {
border: none;
.header {
display: none;
}
.controls, .volume {
max-width: 20rem;
margin: 0 auto;
}
&.collapsed {
@ -263,33 +242,35 @@
display: none;
}
.next {
font-size: 1.8rem;
.play, .next {
font-size: 2rem;
border: none;
}
.play {
font-size: 2.2rem;
}
}
.volume {
display: none;
}
}
@include media-breakpoint-down(sm) {
.cover {
.details {
font-size: 0.875rem;
h4 {
font-size: 1.25rem;
}
}
}
}
@include media-breakpoint-between(xl, xxl) {
.controls {
margin: 0.875rem -1rem;
justify-content: space-around;
}
.volume {
margin: 0 -1rem;
i {
margin: 0.25rem;
@include media-breakpoint-down(is) {
.cover {
.details {
font-size: 0.75rem;
h4 {
font-size: 1rem;
}
}
}
}

View file

@ -1,6 +1,5 @@
import { Component, HostBinding, Input } from '@angular/core';
import { PlayerService, Track } from '../../../@core/data/player.service';
import { PlayerService, Track } from '../../../../@core/data/player.service';
@Component({
selector: 'ngx-player',

View file

@ -1,6 +1,7 @@
<div class="header">Room Management</div>
<div class="room-selector">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
class="room-selector" [attr.viewBox]="viewBox" preserveAspectRatio="xMidYMid">
[attr.viewBox]="viewBox" preserveAspectRatio="xMidYMid">
<defs>
<filter id="f2" x="-50%" y="-50%" width="200%" height="200%">
@ -82,3 +83,4 @@
[attr.x]="room.name.x" [attr.y]="room.name.y">{{room.name.text}}</text>
</g>
</svg>
</div>

View file

@ -2,6 +2,11 @@
@import '~@nebular/theme/components/card/card.component.theme';
@include nb-install-component() {
svg {
width: 100%;
}
.stroke-pattern {
fill: none;
stroke: #bdc4cd;
@ -60,12 +65,7 @@
.header {
@include nb-card-header();
border-bottom: none;
}
.room-selector {
width: 80%;
display: block;
margin: 0 auto;
padding-bottom: 0;
}
@include nb-for-theme(cosmic) {

View file

@ -16,7 +16,24 @@
flex-direction: row;
}
@include media-breakpoint-down(xl) {
ngx-room-selector {
display: flex;
flex-direction: column;
flex: 1;
/deep/ .room-selector {
display: flex;
align-items: center;
justify-items: center;
flex: 1;
margin: 0 auto;
width: 90%;
max-width: 650px;
padding-bottom: 1rem;
}
}
@include media-breakpoint-down(md) {
&.expanded ngx-room-selector {
display: none;
}

View file

@ -1,5 +1,5 @@
import { Component, HostBinding } from '@angular/core';
import { NbMediaBreakpoint } from '@nebular/theme';
import { NbThemeService, NbMediaBreakpoint, NbMediaBreakpointsService } from '@nebular/theme';
@Component({
selector: 'ngx-rooms',
@ -8,7 +8,7 @@ import { NbMediaBreakpoint } from '@nebular/theme';
<nb-card size="large">
<i (click)="collapse()" class="ion-ios-arrow-down collapse" [hidden]="isCollapsed()"></i>
<ngx-room-selector (select)="select($event)"></ngx-room-selector>
<ngx-player [collapsed]="isCollapsed()"></ngx-player>
<ngx-player [collapsed]="isCollapsed() && breakpoint.width <= breakpoints.md"></ngx-player>
</nb-card>
`,
})
@ -18,6 +18,19 @@ export class RoomsComponent {
private expanded: boolean;
private selected: number;
breakpoint: NbMediaBreakpoint;
breakpoints: any;
constructor(private themeService: NbThemeService,
private breakpointService: NbMediaBreakpointsService) {
this.breakpoints = breakpointService.getBreakpointsMap();
themeService.onMediaQueryChange()
.subscribe(([oldValue, newValue]) => {
this.breakpoint = newValue;
});
}
select(roomNumber) {
if (this.isSelected(roomNumber)) {
this.expand();