Narrow cards: row tags head their row (decided per card) so text keep… · nicoloboschi/giotto@8268996 · GitHub
Skip to content

Commit 8268996

Browse files
committed
Narrow cards: row tags head their row (decided per card) so text keeps the width; player: step arrows above the caption at a fixed width, so they never move
1 parent 12e6e38 commit 8268996

3 files changed

Lines changed: 36 additions & 9 deletions

File tree

‎lib/blocks.js‎

Lines changed: 18 additions & 7 deletions

‎lib/player.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ svg { display: block; margin: 0 auto; }
2626
.foot { display: flex; flex-direction: column; align-items: center; gap: 2px; }
2727
.nav { display: flex; align-items: center; gap: 2px; font-size: .78em; color: var(--fig-muted, #6b7280); font-variant-numeric: tabular-nums; }
2828
.nav[hidden] { display: none; }
29+
.nav span { min-width: 4.6em; text-align: center; }
2930
.nav button { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; font-size: 1.3em; line-height: 1; padding: 2px 7px; border-radius: 5px; }
3031
.nav button:hover { color: var(--fig-fg, inherit); background: var(--fig-surface, transparent); }
3132
.cap { min-height: 1.45em; text-align: center; color: var(--fig-muted, #6b7280); font-size: .92em; line-height: 1.45; transition: opacity .3s; }
@@ -43,8 +44,10 @@ export class GiottoPlayer extends Base {
4344
super();
4445
this.state = { si: 0, t: 0, playing: false, speed: 1, hover: null, full: false, seen: true };
4546
const root = this.attachShadow({ mode: 'open' });
46-
root.innerHTML = `<style>${CSS}</style><div class="wrap"><div class="bar" part="controls"></div><div class="view"><svg xmlns="http://www.w3.org/2000/svg" role="img"></svg></div><div class="foot"><div class="cap" part="caption" aria-live="polite"></div>`
47-
+ '<div class="nav" part="steps" hidden><button title="Previous step">‹</button><span></span><button title="Next step">›</button></div></div></div>';
47+
root.innerHTML = `<style>${CSS}</style><div class="wrap"><div class="bar" part="controls"></div><div class="view"><svg xmlns="http://www.w3.org/2000/svg" role="img"></svg></div><div class="foot">`
48+
// The step arrows sit above the narration, so a caption that wraps to more lines never moves them.
49+
+ '<div class="nav" part="steps" hidden><button title="Previous step">‹</button><span></span><button title="Next step">›</button></div>'
50+
+ '<div class="cap" part="caption" aria-live="polite"></div></div></div>';
4851
[this.wrap, this.bar, this.view, this.svg, this.cap, this.foot, this.nav] = ['.wrap', '.bar', '.view', 'svg', '.cap', '.foot', '.nav'].map((q) => root.querySelector(q));
4952
this.count = this.nav.querySelector('span');
5053
const [prev, next] = this.nav.querySelectorAll('button');

‎test/render.test.js‎

Lines changed: 13 additions & 0 deletions

0 commit comments

Comments
 (0)