Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1783360840721.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
gamut: minor
---

remove scss from video
2 changes: 1 addition & 1 deletion packages/gamut/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"rm -rf ./dist",
"babel ./src --out-dir ./dist --extensions \".ts,.tsx\"",
"tsc --emitDeclarationOnly --project ./tsconfig.lib.json",
"cpy './src/**/*.{d.ts,scss,svg,png}' ./dist"
"cpy './src/**/*.{d.ts,scss,css,svg,png}' ./dist"
],
"parallel": false
}
Expand Down
6 changes: 5 additions & 1 deletion packages/gamut/src/Video/lib/VidstackPlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/* Third-party Vidstack default theme styles */
/* eslint-disable gamut/no-css-standalone */
import '../styles/vds_base_theme.scss';
import '../vidstack-vendor.css';

import { styledOptions } from '@codecademy/gamut-styles';
import { Global } from '@emotion/react';
import styled, { CSSObject } from '@emotion/styled';
import {
isYouTubeProvider,
Expand All @@ -18,6 +20,7 @@ import React, { useRef } from 'react';

import { Box } from '../../Box';
import { VideoProps } from '..';
import { vdsBaseThemeStyles } from '../styles';
import { keyboardShortcuts } from './utils/constants';
import { vdsVariables } from './utils/variables';
import { VideoLayout } from './VideoLayout';
Expand Down Expand Up @@ -80,6 +83,7 @@ export const VidstackPlayer: React.FC<VidstackPlayerProps> = ({
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.

<MediaPlayer
autoPlay={autoplay}
controls={showDefaultProviderControls}
Expand Down
101 changes: 101 additions & 0 deletions packages/gamut/src/Video/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { css } from '@emotion/react';

export const vdsBaseThemeStyles = css`
/**
* Youtube overlay
* - Why 120% ? hiding yt logo and copy link button which are not accessible.
*/
iframe.vds-youtube[data-no-controls] {
height: 120%;
}

[data-started] iframe.vds-youtube[data-no-controls] {
height: 1000%;
}

/* Control buttons */
:where(.vds-button .vds-icon) {
border-radius: unset;
}

.vds-controls button {
border-radius: var(--media-button-border-radius);
}

:where(.vds-video-layout[data-sm]) :where(.vds-button) {
padding: 0px 4px !important;
}

/* Small layout volume / time slider */
:where(.vds-video-layout[data-sm] .vds-volume-slider .vds-slider-track) {
background-color: var(--color-gray-600);
}
:where(.vds-video-layout[data-sm] .vds-volume-slider .vds-slider-track-fill) {
background-color: var(--color-secondary);
}
.vds-video-layout .vds-time-slider .vds-slider-value {
border: unset;
color: white;
}

/* Tooltip */
.vds-tooltip-content::after {
content: '';
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
border-style: solid;
display: block;
width: 1rem;
height: 1rem;
position: absolute;
border-color: currentColor;
}
:where(.vds-tooltip-content[data-placement~='top'])::after {
border-width: 0 1px 1px 0;
bottom: -0.5rem;
left: calc(50% - 0.5rem);
background-image: linear-gradient(
to top left,
var(--color-background-contrast) 55%,
rgba(0, 0, 0, 0) 20%
);
}

:where(.vds-tooltip-content[data-placement~='bottom'])::after {
border-width: 1px 0px 0px 1px;
top: -0.5rem;
left: calc(50% - 0.5rem);
background-image: linear-gradient(
to bottom right,
var(--color-background-contrast) 55%,
rgba(0, 0, 0, 0) 20%
);
}

:where(.vds-tooltip-content[data-placement~='start'])::after {
left: calc(0% + 0.5rem);
}
:where(.vds-tooltip-content[data-placement~='end'])::after {
left: unset;
right: calc(0% + 0.5rem);
}

@keyframes vds-tooltip-exit {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes vds-tooltip-enter {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
`;
101 changes: 0 additions & 101 deletions packages/gamut/src/Video/styles/vds_base_theme.scss

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gamut/src/Video/vidstack-vendor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,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";
Comment on lines +1 to +3

@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

Loading