You built it. Now brag. Turn the project you just created into a short, shareable launch video with one command.
Fix reduced-motion hero fallback
shunithaviv9a5ce91adaa3
diff --git a/docs/index.html b/docs/index.htmlindex 8d5168e..519f273 100644--- a/docs/index.html+++ b/docs/index.html@@ -38,13 +38,15 @@class="hero-video-media"src="assets/brag-about-brag.mp4"poster="assets/hero-poster.jpg"- autoplaymutedloopplaysinlinepreload="auto"></video><button id="hero-mute" class="hero-mute" type="button" aria-label="unmute brag video" aria-pressed="true">+ <svg class="icon-play" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">+ <path d="M8 5v14l11-7z"/>+ </svg><svg class="icon-muted" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M3 9v6h4l5 4V5L7 9H3zm13.59 3l2.7-2.7-1.41-1.42L15.17 10.6 12.46 7.88l-1.41 1.41 2.71 2.71-2.71 2.71 1.41 1.41 2.71-2.7 2.71 2.7 1.41-1.41-2.7-2.7z"/></svg>diff --git a/docs/main.js b/docs/main.jsindex e768a35..b46806a 100644--- a/docs/main.js+++ b/docs/main.js@@ -1,9 +1,49 @@(() => {- // Hero mute toggle+ // Hero playback and mute controlsconst heroVid = document.getElementById('hero-vid');const heroMute = document.getElementById('hero-mute');if (heroVid && heroMute) {+ const heroMuteLabel = heroMute.querySelector('.hero-mute-label');+ const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');++ const setControlMode = (mode) => {+ if (mode === 'play') {+ heroMute.dataset.mode = 'play';+ heroMute.removeAttribute('aria-pressed');+ heroMute.setAttribute('aria-label', 'play brag video');+ if (heroMuteLabel) heroMuteLabel.textContent = 'play video';+ return;+ }++ delete heroMute.dataset.mode;+ heroMute.setAttribute('aria-pressed', heroVid.muted ? 'true' : 'false');+ heroMute.setAttribute('aria-label', heroVid.muted ? 'unmute brag video' : 'mute brag video');+ if (heroMuteLabel) heroMuteLabel.textContent = 'tap for sound';+ };++ const applyMotionPreference = () => {+ if (reducedMotion.matches) {+ heroVid.pause();+ heroVid.load();+ setControlMode('play');+ return;+ }++ heroVid.muted = true;+ setControlMode('mute');+ const playback = heroVid.play();+ if (playback && playback.catch) playback.catch(() => {});+ };+heroMute.addEventListener('click', () => {+ if (heroMute.dataset.mode === 'play') {+ heroVid.muted = false;+ setControlMode('mute');+ const playback = heroVid.play();+ if (playback && playback.catch) playback.catch(() => {});+ return;+ }+const wasMuted = heroVid.muted;heroVid.muted = !wasMuted;heroMute.setAttribute('aria-pressed', wasMuted ? 'false' : 'true');@@ -14,6 +54,9 @@if (p && p.catch) p.catch(() => {});}});++ applyMotionPreference();+ reducedMotion.addEventListener('change', applyMotionPreference);}// Gallery videos use the native <video controls> player. No custom JS.diff --git a/docs/styles.css b/docs/styles.cssindex dc3ca56..bf39fdf 100644--- a/docs/styles.css+++ b/docs/styles.css@@ -250,9 +250,6 @@ button { font: inherit; cursor: pointer; }object-fit: cover;display: block;}-@media (prefers-reduced-motion: reduce) {- .hero-video-media { display: none; }-}/* Mute toggle, lower-right of the hero tile */.hero-mute {@@ -284,7 +281,10 @@ button { font: inherit; cursor: pointer; }}.hero-mute:focus-visible { box-shadow: 0 0 0 3px var(--hero-tint); }.hero-mute svg { width: 16px; height: 16px; }+.hero-mute .icon-play,.hero-mute .icon-sound { display: none; }+.hero-mute[data-mode="play"] .icon-play { display: inline-block; }+.hero-mute[data-mode="play"] .icon-muted { display: none; }.hero-mute[aria-pressed="false"] .icon-muted { display: none; }.hero-mute[aria-pressed="false"] .icon-sound { display: inline-block; }.hero-mute[aria-pressed="false"] .hero-mute-label::after { content: "sound on"; }