-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some small problems and started with #10 (background play)
- Loading branch information
Showing
9 changed files
with
159 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import styled, {css} from "styled-components"; | ||
import {motion} from "framer-motion"; | ||
import {navigate} from "gatsby"; | ||
|
||
const StyledVideoContainer = styled(motion.div)` | ||
${(props) => props.background ? css` | ||
position: fixed; | ||
width: 15vw; | ||
bottom: 1rem; | ||
left: 1rem; | ||
cursor: pointer; | ||
` : css` | ||
position: relative; | ||
width: 100%; | ||
height: 0; | ||
padding-top: 56.25%; | ||
margin-bottom: 1rem; | ||
`} | ||
`; | ||
const StyledVideo = styled.video` | ||
width: 100%; | ||
outline: none; | ||
${(props) => props.background ? css` | ||
width: 15vw; | ||
` : css` | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
`} | ||
`; | ||
|
||
export default function VideoPlayer({ src, ...props }) { | ||
export default function VideoPlayer({ video, background, ...props }) { | ||
return ( | ||
<StyledVideo src={src} controls autoPlay {...props}> | ||
Your browser doesn't support HTML5 video playback. Please use a modern browser. | ||
</StyledVideo> | ||
<StyledVideoContainer background={background} onClick={() => navigate(`/video/${video.filename}`)} {...props}> | ||
<StyledVideo src={video.link.replace(".dev", ".moe")} background={background} controls={!background} autoPlay> | ||
Your browser doesn't support HTML5 video playback. Please use a modern browser. | ||
</StyledVideo> | ||
</StyledVideoContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters