Skip to content

refactor(Video): Remove SCSS from Video#3390

Open
aresnik11 wants to merge 10 commits into
mainfrom
ajr-video-no-scss
Open

refactor(Video): Remove SCSS from Video#3390
aresnik11 wants to merge 10 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 Gloabal inside the existing VariableProvider 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.
    • 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 as expected. (Note: not sure why the video only buffers on preview/prod but it seems to work locally)

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 373994b


☁️ Nx Cloud last updated this comment at 2026-07-15 19:35:24 UTC

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.08%. Comparing base (c9200cc) to head (373994b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3390      +/-   ##
==========================================
- Coverage   90.55%   90.08%   -0.47%     
==========================================
  Files         398      271     -127     
  Lines        6586     5671     -915     
  Branches     2141     1910     -231     
==========================================
- Hits         5964     5109     -855     
+ Misses        613      553      -60     
  Partials        9        9              
Flag Coverage Δ
main ?
pull-request 90.08% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aresnik11 aresnik11 changed the title remove scss refactor(Video): Remove SCSS from Video Jul 6, 2026
aresnik11 and others added 5 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>
… beak

Applying vdsBaseThemeStyles as a styled() argument on VariableProvider
scoped every .vds-* selector under the player's generated class, which
broke the tooltip beak (rendered as a full diamond). Render the overrides
via <Global> instead so they apply at document level, matching the
original flat cascade and reaching portaled .vds-* nodes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecademydev

Copy link
Copy Markdown
Collaborator

📬 Published Alpha Packages:

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

@github-actions

Copy link
Copy Markdown
Contributor

@aresnik11
aresnik11 marked this pull request as ready for review July 16, 2026 20:09
@aresnik11
aresnik11 requested a review from a team as a code owner July 16, 2026 20:09

@dreamwasp dreamwasp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on mono, i was seeing that the tayra examples don't have the Closed Caption buttons on the ones on prod do. idk if thats just a weird tayra issue but wanted to mention it

style={{ width, height }}
variables={vdsVariables}
>
<Global styles={vdsBaseThemeStyles} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only thing about this i find awkward is that is there's more than one Video component rendered on a page this Global sheet gets injected over & over so maybe just a check/hook to only render one per page makes sense

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tho this may be deduped by emotion itself? idk just something to think about

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related Q: does it have to be a Global?
is the intention that these styles get inherited by MediaPlayer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm good q. so originally i had them being added to the VariableProvider (you can see in this commit 373994b) but the styles werent working bc the classnames didnt match

Applying vdsBaseThemeStyles as a styled() argument on VariableProvider
scoped every .vds-* selector under the player's generated class, which
broke the tooltip beak (rendered as a full diamond). Render the overrides
via instead so they apply at document level, matching the
original flat cascade and reaching portaled .vds-* nodes.

@aresnik11

Copy link
Copy Markdown
Contributor Author

on mono, i was seeing that the tayra examples don't have the Closed Caption buttons on the ones on prod do. idk if thats just a weird tayra issue but wanted to mention it

ill look into it but im guessing the captions get inserted from Percipio video data that doesnt work on previews/staging. that would be the same reason i had to force the VidstackPlayer to render in the mono PR

Comment on lines +1 to +3
@import "~@vidstack/react/player/styles/default/theme.css";
@import "~@vidstack/react/player/styles/default/layouts/video.css";
@import "~@vidstack/react/player/styles/default/layouts/audio.css";

@jakemhiller jakemhiller Jul 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think importing these via JS imports is technically more compatible with tools like vite. the ~/* syntax is a webpack/css-loader thing that isn't directly supported in those tools without config changes, but directly importing CSS into JS is supported.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call! doing it via JS broke the Storybook page (styles weren't getting applied) but let me see if I can fix that separately

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.

5 participants