Skip to content
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

make video controls appear on hover or focus #1043

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
make video controls appear on hover or focus
fstorr committed Sep 19, 2019
commit e2916f54ce29fc33c57ab4fee8be66509e12f8f1
25 changes: 23 additions & 2 deletions packages/2018/src/components/NewHomePage/index.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
/** @jsx jsx */
import { css, jsx, Global } from "@emotion/core";
import emotionReset from "emotion-reset";
import { Fragment } from "react";
import { Fragment, useState } from "react";
import {
Button,
BrandColors,
@@ -65,6 +65,15 @@ const sectionCivicLayout = css`
`;

const HomePage = () => {
const [controlSettings, setControlSettings] = useState(false);

const showControls = () => {
setControlSettings(true);
};
const hideControls = () => {
setControlSettings(false);
};

return (
<Fragment>
<Global
@@ -81,7 +90,19 @@ const HomePage = () => {
A system for public data, built on public collaboration
</p>
<div className="intro-wrapper">
<video className="placeholder-intro-image" autoPlay playsInline muted loop>
<video
className="placeholder-intro-image"
autoPlay
controls={controlSettings}
playsInline
muted
loop
tabIndex="0"
onMouseEnter={showControls}
onMouseLeave={hideControls}
onFocus={showControls}
onBlur={hideControls}
>
<source type="video/mp4" src={test} />
</video>
<p className="intro-text">