File tree Expand file tree Collapse file tree 7 files changed +30
-23
lines changed
apps/codelab/src/app/admin/content/presentation-editor Expand file tree Collapse file tree 7 files changed +30
-23
lines changed Original file line number Diff line number Diff line change 9
9
< div class ="wrapper " *ngIf ="presentation$ | async as presentation ">
10
10
< slides-side-panel
11
11
[presentationId] ="presentation.id "
12
- [selectedSlide ] ="selectedSlide $ | async "
12
+ [currentSlideIndex ] ="currentSlideIndex $ | async "
13
13
[slides] ="presentation.slides "
14
14
> </ slides-side-panel >
15
15
< div class ="editor " *ngIf ="currentSlide$ | async as slide; else noSlide ">
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ import { combineLatest } from 'rxjs';
6
6
import { ContentPresentation } from './types' ;
7
7
import { NavigationService } from './services/navigation.service' ;
8
8
9
- declare const require ;
10
-
11
9
@Component ( {
12
10
selector : 'slides-content' ,
13
11
templateUrl : './content.component.html' ,
@@ -25,7 +23,7 @@ export class ContentComponent {
25
23
} )
26
24
) ;
27
25
28
- selectedSlide $ = this . contentService . selectedSlide $;
26
+ currentSlideIndex $ = this . contentService . currentSlideIndex $;
29
27
30
28
currentSlide$ = combineLatest ( [
31
29
this . navigationService . selectedSlide$ ,
Original file line number Diff line number Diff line change 1
1
< div class ="wrapper " *ngIf ="contentService.state$ | async as presentations ">
2
2
< div
3
3
class ="editor "
4
- *ngIf ="presentations[contentService.selectedSlide $ | async] as slide "
4
+ *ngIf ="presentations[contentService.currentSlideIndex $ | async] as slide "
5
5
>
6
6
< slides-slide-preview [slide] ="slide "> </ slides-slide-preview >
7
7
</ div >
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ const DOC_KEY = 'presentations';
20
20
21
21
@Injectable ( )
22
22
export class ContentService implements OnDestroy {
23
- private readonly selectedSlideSubject = new BehaviorSubject ( 0 ) ;
23
+ private readonly currentSlideSubject = new BehaviorSubject ( 0 ) ;
24
24
25
- public readonly selectedSlide $ = this . selectedSlideSubject ;
25
+ public readonly currentSlideIndex $ = this . currentSlideSubject ;
26
26
27
27
readonly presentations = this . firestore . collection ( 'presentations' ) ;
28
28
private readonly presentations$ = this . presentations
@@ -94,7 +94,7 @@ export class ContentService implements OnDestroy {
94
94
}
95
95
96
96
addSlide ( presentationId : string ) {
97
- const index = this . selectedSlide $. value ;
97
+ const index = this . currentSlideIndex $. value ;
98
98
const action = {
99
99
type : 'addSlide' ,
100
100
payload : {
Original file line number Diff line number Diff line change 1
1
< div class ="slides-wrapper ">
2
2
< button (click) ="addSlide() "> Add</ button >
3
3
4
- < div cdkDropList (cdkDropListDropped) ="reorder.emit($event) ">
4
+ < div (cdkDropListDropped) ="reorder.emit($event) " cdkDropList >
5
5
< button
6
- class ="slide-wrapper "
7
- *ngFor ="let slide of slides; let i = index "
8
- [class.selected] ="i === selectedSlide "
9
- inert ="true "
6
+ inert
10
7
(click) ="this.navigationService.goToSlide(presentationId, i) "
8
+ *ngFor ="let slide of slides; let i = index "
9
+ [class.selected] ="i === currentSlideIndex "
10
+ class ="slide-wrapper "
11
11
>
12
- < div
13
- cdkDrag
14
- class ="slide "
15
- style ="pointer-events: none;text-decoration: none; color: inherit "
16
- >
12
+ < div cdkDrag class ="slide ">
17
13
< slides-slide-preview
18
- mode =" preview "
14
+ [class.selected] =" i === currentSlideIndex "
19
15
[slide] ="slide "
20
- [class.selected] =" i === selectedSlide "
16
+ mode =" preview "
21
17
> </ slides-slide-preview >
22
18
</ div >
23
19
</ button >
Original file line number Diff line number Diff line change 8
8
overflow : scroll ;
9
9
display : flex ;
10
10
flex-direction : column ;
11
+ width : 114px ;
11
12
height : 100% ;
13
+ padding : 0 4px ;
12
14
box-shadow : 1px 0 2px 0 #ddd ;
13
- width : 114px ;
14
15
background : #f8f8f8 ;
15
16
}
16
17
17
18
.slide-wrapper.selected {
18
19
background : #dde ;
19
20
}
21
+
20
22
.slide-wrapper {
21
23
display : flex ;
22
24
justify-content : space-around ;
25
+ width : 100% ;
26
+ min-height : 40px ;
23
27
padding : 4px 20px ;
24
28
box-sizing : border-box ;
25
- border : 0 solid ;
29
+ border : 1px solid #ddd ;
30
+ border-radius : 4px ;
26
31
background : #f8f8f8 ;
27
32
margin : 0 ;
28
33
}
34
+
35
+ .slide-wrapper + .slide-wrapper {
36
+ margin-top : 4px ;
37
+ }
38
+
29
39
.slide {
30
40
padding : 0 ;
31
41
background : #fff ;
35
45
display : flex ;
36
46
margin : 0 ;
37
47
text-align : left ;
48
+ pointer-events : none ;
49
+ text-decoration : none ;
50
+ color : inherit ;
38
51
39
52
slides-slide-preview {
40
53
zoom : 0.2 ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import { NavigationService } from '../services/navigation.service';
19
19
export class SidePanelComponent {
20
20
@Input ( ) slides ;
21
21
@Output ( ) reorder = new EventEmitter ( ) ;
22
- @Input ( ) selectedSlide = 0 ;
22
+ @Input ( ) currentSlideIndex = 0 ;
23
23
@Input ( ) presentationId ! : string ;
24
24
25
25
constructor (
You can’t perform that action at this time.
0 commit comments