Skip to content

refactor(Video): Remove SCSS from Video#3390

Draft
aresnik11 wants to merge 8 commits into
mainfrom
ajr-video-no-scss
Draft

refactor(Video): Remove SCSS from Video#3390
aresnik11 wants to merge 8 commits into
mainfrom
ajr-video-no-scss

Conversation

@aresnik11

@aresnik11 aresnik11 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Overview

The Video component was the last consumer of a standalone SCSS file (vds_base_theme.scss) for styling the Vidstack player. This PR removes that SCSS dependency, splitting its contents into two more idiomatic sources:

  • vidstack-vendor.css — the three third-party Vidstack @imports (default theme + video/audio layouts), imported as plain CSS.
  • styles.ts — our custom Vidstack overrides (YouTube overlay, control buttons, sliders, tooltips, keyframes), converted to an Emotion css template (vdsBaseThemeStyles) and applied through the existing VariableProvider styled component.

This aligns the Video component with the rest of Gamut's Emotion-based styling and removes the last SCSS file from the package.

PR Checklist

  • Related to designs:
  • Related to JIRA ticket: GMT-1662
  • Version plan added/updated (or not needed)
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions tests for the code change
  • The alpha package of this PR is passing end-to-end tests in all relevant Codecademy repositories

Testing instructions

Verify the Vidstack player looks and behaves identically to main — the goal is a no-visual-change refactor.

  1. Run Storybook and open the Video stories.
  2. For a standard (mp4/HLS) video, confirm:
    • Custom control bar renders with correct button styling and border radius.
    • Play/pause, volume slider, and time slider (scrubber) look correct in both the default and small layouts.
    • Hovering a control shows the tooltip with the correct arrow/caret and enter/exit fade animation.
  3. For a YouTube video, confirm the YouTube logo / copy-link overlay is still cropped out (the iframe.vds-youtube height override) both before and after playback starts.
  4. Confirm the poster/placeholder image and captions/text tracks still render.
  5. Build the package (yarn nx build gamut) and confirm vidstack-vendor.css is present in dist/Video/.

Testing Scenarios

Story 1: Default (Internal MP4 Video)

  • Player Renders

    • Video player displays without errors
    • No console errors
    • Layout is responsive (test mobile, tablet, desktop)
  • Playback Controls

    • Play button starts video
    • Pause button pauses video
    • Play/pause can toggle multiple times
    • Play indicator appears during playback
  • Volume Control

    • Volume slider is visible
    • Dragging volume slider adjusts volume
    • Mute button toggles mute state
    • Volume level persists when unmuting
  • Seek Bar

    • Seek bar displays video duration
    • Dragging seek bar jumps to correct time
    • Current time indicator updates during playback
    • Seeking backward works correctly
    • Seeking forward works correctly
  • Fullscreen

    • Fullscreen button visible and clickable
    • Video enters fullscreen when button clicked
    • Video exits fullscreen correctly (ESC key or button)
    • Controls remain visible in fullscreen
  • Player Title

    • Title "01: Introduction-to-Quantum-Computing" displays above player
    • Custom translation "Play Intro Video" shows in player UI

Story 2: Video With Tracks and Thumbnails (HLS + Captions)

  • Placeholder Image

    • Poster image displays before play
    • Image is correct (Sprite Fight thumbnail)
    • Image disappears when video starts playing
    • Clicking image starts playback
  • Text Tracks - Subtitles

    • Captions panel is visible in player controls
    • English subtitle option appears
    • Spanish subtitle option appears
    • Spanish is marked as default (auto-loads)
    • Subtitles appear at bottom of video when playing
    • Subtitles are readable (good contrast, size)
    • Subtitles sync with audio
    • Can toggle subtitles on/off
    • Switching between English/Spanish works
    • No captions when "No Subtitles" selected
  • Chapter Markers

    • Chapter track loads (should not display as captions, but affects seek bar)
    • Chapters visible on seek bar/timeline (if UI supports it)
    • Seeking to different chapters works
  • Thumbnails

    • Hover over seek bar shows thumbnail preview
    • Thumbnail changes as you hover at different times
    • Thumbnail is accurate to video content at that time
  • HLS Streaming

    • Video plays smoothly without buffering (good network)
    • Adaptive bitrate switching occurs (watch Network tab for quality changes)
    • No errors in console during playback
  • Video Duration

    • Duration displays correctly on seek bar
    • Duration updates as video plays
  • Buffering

    • Open DevTools → Network tab
    • Throttle to "Slow 3G"
    • Play video
    • Watch for buffering indicator
    • Video resumes after buffering
    • Quality drops automatically if needed

Story 3: YouTube With Captions

YouTube uses VidstackPlayer instead of ReactVideoPlayer when captions are present.

  • Player renders as VidstackPlayer (not React-Player)
  • YouTube video loads and plays
  • Captions appear and sync with audio
  • Caption toggle works
  • All VidstackPlayer controls functional (play, pause, seek, volume, fullscreen)
  • Caption styling is readable

Story 4: Multiple Video Sources

Test fallback behavior when multiple video formats provided.

  • Video plays from first available format (browser support)
  • Uses MP4 on most browsers
  • Uses WebM on Chrome/Firefox if available
  • Falls back to next format if first fails
  • All controls work with multiple sources
  • No console errors

Story 5: YouTube without embed

Tests the edge case where showPlayerEmbed prop is false, forcing VidstackPlayer for YouTube/Vimeo.

  • VidstackPlayer renders (not React-Player embed)
  • YouTube video loads via VidstackPlayer
  • All VidstackPlayer controls work
  • Video plays and pauses correctly
  • No iframe embed appears (confirms React-Player not used)

Regression Testing Checklist

Youtube and Vimeo stories without captions use ReactVideoPlayer (React-Player wrapper) which was not modified

  • Default story (MP4 internal) - VidstackPlayer works
  • VideoWithTracksAndThumbnails - HLS/captions/chapters work
  • Youtube story - ReactVideoPlayer unchanged (still works)
  • Vimeo story - ReactVideoPlayer unchanged (still works)
  • New YoutubeWithCaptions story - VidstackPlayer handles YouTube+captions
  • New MultipleVideoSources story - Fallback works
  • New YoutubeWithoutEmbed story - showPlayerEmbed={false} forces VidstackPlayer

PR Links and Envs

Repository PR Link
Monolith Monolith PR
Mono Mono PR

@nx-cloud

nx-cloud Bot commented Jun 30, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 573e728


☁️ Nx Cloud last updated this comment at 2026-07-09 17:12:24 UTC

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@aresnik11 aresnik11 changed the title remove scss refactor(Video): Remove SCSS from Video Jul 6, 2026
aresnik11 and others added 3 commits July 7, 2026 15:32
Update vidstack-vendor.css to use the webpack ~ module resolution prefix,
which tells webpack to resolve imports from node_modules. This ensures
the CSS imports are correctly resolved in both Storybook and consumer
builds like Codecademy.

Fixes module resolution error: "Can't resolve './@vidstack/react/..." when
Codecademy's webpack processes the CSS file from the gamut dist output.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

Package Version npm Diff
@codecademy/gamut 72.2.5-alpha.b37ba9.0 npm diff
@codecademy/gamut-icons 9.57.11-alpha.b37ba9.0 npm diff
@codecademy/gamut-illustrations 0.58.16-alpha.b37ba9.0 npm diff
@codecademy/gamut-kit 3.0.9-alpha.b37ba9.0 npm diff
@codecademy/gamut-patterns 0.10.35-alpha.b37ba9.0 npm diff
@codecademy/gamut-styles 20.0.3-alpha.b37ba9.0 npm diff
@codecademy/gamut-tests 6.0.6-alpha.b37ba9.0 npm diff
@codecademy/variance 0.26.2-alpha.b37ba9.0 npm diff
eslint-plugin-gamut 2.4.4-alpha.b37ba9.0 npm diff

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants