Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit fe3c39e

Browse files
merge: a couple of UX improvements
2 parents b69c470 + 0c50539 commit fe3c39e

File tree

19 files changed

+174
-129
lines changed

19 files changed

+174
-129
lines changed

docs/docs/deck/app-deck-pager/app-deck-pager.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44

55
Also worth to notice that the pager inherits per default the document and deck direction (LTR or RTL for example).
66

7-
- [Show or hide](#app-deck-pager-show-or-hide)
7+
- [Deck](#app-deck-pager-deck)
88
- [Customization](#app-deck-pager-customization)
99

1010
## Show or hide
1111

12-
The show or hide options of the pager are available on the `<deckgo-deck>` element.
12+
To show or hide the pager, a CSS4 variable has to be set on the `<deckgo-deck>` element. Two more options are also available when set on this element.
1313

14-
| Attribute | Type | Default | Description |
15-
| -------------------------- |-----------------|-----------------|-----------------|
16-
| pagerPercentage | boolean | true | Show or hide the progression in percentage inside the pager |
14+
| Attribute | Default | Description |
15+
| -------------------------- |-----------------|-----------------|
16+
| --pager-display | | The display property of the pager. Set to `none` to hide it. |
17+
| --pager-position-left | | The left attribute of the absolute positioning of the pager over the deck |
18+
| --pager-position-right | | The right attribute of the absolute positioning of the pager over the deck |
1719

1820
## Customization
1921

@@ -31,8 +33,9 @@ The following style options are available to style the pager:
3133
| --pager-text-size | 0.5em | |
3234
| --pager-stroke-outer-width | 2.8 | |
3335
| --pager-stroke-inner-width | 1.8 | |
34-
| --pager-position-left | | |
35-
| --pager-position-right | | |
36-
| --pager-display | | To hide the pager |
36+
| --pager-text-percentage-display | hidden | Set to `block` to display a progression with percentage (for example: 35%) |
37+
| --pager-text-slides-display | hidden | Set to `block` to display a progression as slides' count (for example: 2/15) |
38+
39+
Note: of course if you would display both `--pager-text-percentage-display` and `--pager-text-slides-display` it would be a weird display, use just one at once.
3740

3841
[DeckDeckGo]: https://deckdeckgo.com

docs/src/app/pages/docs/deck/app-deck-pager/app-deck-pager.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,33 @@ export class AppDeckPager {
3434
<p><a href="https://deckdeckgo.com">DeckDeckGo</a> will per default display a pager in form of a progress circle bar. It&#39;s possible to hide it or to customize the following various style options.</p>
3535
<p>Also worth to notice that the pager inherits per default the document and deck direction (LTR or RTL for example).</p>
3636
<ul>
37-
<li><a href="#app-deck-pager-show-or-hide">Show or hide</a></li>
37+
<li><a href="#app-deck-pager-deck">Deck</a></li>
3838
<li><a href="#app-deck-pager-customization">Customization</a></li>
3939
</ul>
4040
<h2 id="app-deck-pager-show-or-hide">Show or hide</h2>
41-
<p>The show or hide options of the pager are available on the <code>&lt;deckgo-deck&gt;</code> element.</p>
41+
<p>To show or hide the pager, a CSS4 variable has to be set on the <code>&lt;deckgo-deck&gt;</code> element. Two more options are also available when set on this element.</p>
4242
<table>
4343
<thead>
4444
<tr>
4545
<th>Attribute</th>
46-
<th>Type</th>
4746
<th>Default</th>
4847
<th>Description</th>
4948
</tr>
5049
</thead>
5150
<tbody><tr>
52-
<td>pagerPercentage</td>
53-
<td>boolean</td>
54-
<td>true</td>
55-
<td>Show or hide the progression in percentage inside the pager</td>
51+
<td>--pager-display</td>
52+
<td></td>
53+
<td>The display property of the pager. Set to <code>none</code> to hide it.</td>
54+
</tr>
55+
<tr>
56+
<td>--pager-position-left</td>
57+
<td></td>
58+
<td>The left attribute of the absolute positioning of the pager over the deck</td>
59+
</tr>
60+
<tr>
61+
<td>--pager-position-right</td>
62+
<td></td>
63+
<td>The right attribute of the absolute positioning of the pager over the deck</td>
5664
</tr>
5765
</tbody></table>
5866
<h2 id="app-deck-pager-customization">Customization</h2>
@@ -116,21 +124,17 @@ export class AppDeckPager {
116124
<td></td>
117125
</tr>
118126
<tr>
119-
<td>--pager-position-left</td>
120-
<td></td>
121-
<td></td>
122-
</tr>
123-
<tr>
124-
<td>--pager-position-right</td>
125-
<td></td>
126-
<td></td>
127+
<td>--pager-text-percentage-display</td>
128+
<td>hidden</td>
129+
<td>Set to <code>block</code> to display a progression with percentage (for example: 35%)</td>
127130
</tr>
128131
<tr>
129-
<td>--pager-display</td>
130-
<td></td>
131-
<td>To hide the pager</td>
132+
<td>--pager-text-slides-display</td>
133+
<td>hidden</td>
134+
<td>Set to <code>block</code> to display a progression as slides&#39; count (for example: 2/15)</td>
132135
</tr>
133136
</tbody></table>
137+
<p>Note: of course if you would display both <code>--pager-text-percentage-display</code> and <code>--pager-text-slides-display</code> it would be a weird display, use just one at once.</p>
134138
</main>
135139

136140
<app-footer></app-footer>

studio/src/app/components/editor/app-add-slide-action/app-add-slide-action.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export class AppAddSlideAction {
4040
}
4141

4242
render() {
43-
return <ion-button onClick={(e: UIEvent) => this.openSlideAdd(e)} color="primary" shape="round" disabled={this.deckBusy}
44-
size="small" fill="solid">
43+
return <ion-tab-button onClick={(e: UIEvent) => this.openSlideAdd(e)} color="primary" disabled={this.deckBusy} mode="md">
44+
<ion-icon name="add"></ion-icon>
4545
<ion-label>Add slide</ion-label>
46-
</ion-button>;
46+
</ion-tab-button>;
4747
}
4848

4949
}

studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export class DeckEventsHandler {
101101

102102
private onSlidesDidLoad = async ($event: CustomEvent) => {
103103
if ($event) {
104+
await this.initSlideSize();
104105
await this.slideToLastSlide();
105106
}
106107
};
@@ -589,4 +590,18 @@ export class DeckEventsHandler {
589590
resolve();
590591
});
591592
}
593+
594+
initSlideSize(): Promise<void> {
595+
return new Promise<void>(async (resolve) => {
596+
const deck: HTMLElement = this.el.querySelector('deckgo-deck');
597+
598+
if (!deck) {
599+
return;
600+
}
601+
602+
await (deck as any).initSlideSize();
603+
604+
resolve();
605+
});
606+
}
592607
}

studio/src/app/handlers/editor/events/editor/editor-events.handler.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ export class EditorEventsHandler {
66
return new Promise<void>(async (resolve) => {
77
this.el = el;
88

9-
this.el.addEventListener('keyup', this.onKeyUp, false);
9+
const deck: HTMLElement = this.el.querySelector('deckgo-deck');
10+
11+
if (deck) {
12+
deck.addEventListener('keyup', this.onKeyUp, false);
13+
}
14+
1015
this.el.addEventListener('blockSlide', this.onBlockSlide, false);
1116
document.addEventListener('keydown', this.onKeyDown, false);
1217

@@ -15,7 +20,12 @@ export class EditorEventsHandler {
1520
}
1621

1722
destroy() {
18-
this.el.removeEventListener('keyup', this.onKeyUp, true);
23+
const deck: HTMLElement = this.el.querySelector('deckgo-deck');
24+
25+
if (deck) {
26+
deck.removeEventListener('keyup', this.onKeyUp, true);
27+
}
28+
1929
this.el.removeEventListener('blockSlide', this.onBlockSlide, true);
2030
document.removeEventListener('keydown', this.onKeyDown, true);
2131
}

studio/src/app/modals/editor/app-slide-navigate/app-slide-navigate.tsx

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Listen, Element, Prop, h} from '@stencil/core';
1+
import {Component, Listen, Element, State, h} from '@stencil/core';
22

33
@Component({
44
tag: 'app-slide-navigate',
@@ -8,11 +8,13 @@ export class AppSlideNavigate {
88

99
@Element() el: HTMLElement;
1010

11-
@Prop()
11+
@State()
1212
slides: string[];
1313

1414
async componentDidLoad() {
1515
history.pushState({modal: true}, null);
16+
17+
this.slides = await this.getSlidesTitle();
1618
}
1719

1820
@Listen('popstate', { target: 'window' })
@@ -28,6 +30,47 @@ export class AppSlideNavigate {
2830
await (this.el.closest('ion-modal') as HTMLIonModalElement).dismiss(index);
2931
}
3032

33+
private getSlidesTitle(): Promise<string[]> {
34+
return new Promise<string[]>((resolve) => {
35+
if (!document) {
36+
resolve();
37+
return;
38+
}
39+
40+
const results: string[] = [];
41+
42+
const slides: NodeListOf<HTMLElement> = document.querySelectorAll('deckgo-deck > *');
43+
44+
if (slides) {
45+
for (const slide of Array.from(slides)) {
46+
if (slide.tagName && slide.tagName.toLowerCase().indexOf('deckgo-slide') > -1) {
47+
const title: HTMLElement = slide.querySelector('[slot="title"]');
48+
49+
if (title && title.textContent !== '') {
50+
results.push(title.textContent);
51+
} else {
52+
const start: HTMLElement = slide.querySelector('[slot="start"],[slot="header"]');
53+
54+
if (start && start.textContent !== '') {
55+
results.push(start.textContent);
56+
} else {
57+
const end: HTMLElement = slide.querySelector('[slot="end"],[slot="footer"]');
58+
59+
if (end && end.textContent !== '') {
60+
results.push(end.textContent);
61+
} else {
62+
results.push('');
63+
}
64+
}
65+
}
66+
}
67+
}
68+
}
69+
70+
resolve(results);
71+
});
72+
}
73+
3174
render() {
3275
return [
3376
<ion-header>

studio/src/app/pages/core/about/app-about/app-about.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export class AppAbout {
1717
<ion-grid>
1818
<ion-row>
1919
<ion-col size="12" size-md="6">
20-
<h3 class="padding-top">Edit anywhere, display everywhere</h3>
20+
<h3 class="ion-padding-top">Edit anywhere, display everywhere</h3>
2121

22-
<p class="padding-top">DeckDeckGo aims to be the open source web editor for presentations.</p>
22+
<p class="ion-padding-top">DeckDeckGo aims to be the open source web editor for presentations.</p>
2323

2424
<p>What makes it different 🤔? Every presentations published with DeckDeckGo are standalone <strong>Progressive Web Apps</strong> 🚀</p>
2525

0 commit comments

Comments
 (0)