-
Notifications
You must be signed in to change notification settings - Fork 30
Stop showing the pointer cursor when hovering over Cinemagraphs in articles #15163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,19 +25,30 @@ export type SubtitleSize = 'small' | 'medium' | 'large'; | |
|
|
||
| const videoStyles = ( | ||
| aspectRatio: number, | ||
| letterboxed: boolean, | ||
| isInArticle: boolean, | ||
| isFeatureCard: boolean, | ||
| isCinemagraph: boolean, | ||
| ) => css` | ||
| position: relative; | ||
| display: block; | ||
| height: auto; | ||
| width: 100%; | ||
| ${letterboxed && | ||
| /** | ||
| * Videos on cards (i.e. not in articles) should not exceed the viewport | ||
| * height. Instead, they should be scaled and grey bars should be shown on | ||
| * either side. | ||
| */ | ||
| ${!isInArticle && | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer needed following #15119 |
||
| css` | ||
| max-height: 100vh; | ||
| max-height: 100svh; | ||
| `} | ||
| cursor: pointer; | ||
| /** | ||
| * Cinemagraphs should only show a pointer cursor when on a card (where clicking | ||
| * navigates to the article). In articles, they should not show a pointer cursor | ||
| * as clicking does nothing. | ||
| */ | ||
| cursor: ${isCinemagraph && isInArticle ? 'default' : 'pointer'}; | ||
|
|
||
| /* Prevents CLS by letting the browser know the space the video will take up. */ | ||
| aspect-ratio: ${aspectRatio}; | ||
|
|
@@ -139,7 +150,7 @@ type Props = { | |
| subtitleSize?: SubtitleSize; | ||
| /* used in custom subtitle overlays */ | ||
| activeCue?: ActiveCue | null; | ||
| letterboxed: boolean; | ||
| isInArticle: boolean; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we use a prop that's more descriptive of the change it will make within this component? This should now be possible given that the |
||
| isFeatureCard: boolean; | ||
| }; | ||
|
|
||
|
|
@@ -182,17 +193,18 @@ export const SelfHostedVideoPlayer = forwardRef( | |
| subtitleSource, | ||
| subtitleSize, | ||
| activeCue, | ||
| letterboxed, | ||
| isInArticle, | ||
| isFeatureCard, | ||
| }: Props, | ||
| ref: React.ForwardedRef<HTMLVideoElement>, | ||
| ) => { | ||
| const videoId = `video-${uniqueId}`; | ||
| const isCinemagraph = videoStyle === 'Cinemagraph'; | ||
| const showSubtitles = | ||
| videoStyle !== 'Cinemagraph' && !!subtitleSource && !!subtitleSize; | ||
| !isCinemagraph && !!subtitleSource && !!subtitleSize; | ||
|
|
||
| const showControls = | ||
| videoStyle !== 'Cinemagraph' && | ||
| !isCinemagraph && | ||
| ref && | ||
| 'current' in ref && | ||
| ref.current && | ||
|
|
@@ -210,7 +222,12 @@ export const SelfHostedVideoPlayer = forwardRef( | |
| <video | ||
| id={videoId} | ||
| css={[ | ||
| videoStyles(aspectRatio, letterboxed, isFeatureCard), | ||
| videoStyles( | ||
| aspectRatio, | ||
| isInArticle, | ||
| isFeatureCard, | ||
| isCinemagraph, | ||
| ), | ||
| showSubtitles && subtitleStyles(subtitleSize), | ||
| ]} | ||
| crossOrigin="anonymous" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as https://github.com/guardian/dotcom-rendering/pull/15163/changes#r2716362592