PromucFlow_constructor/app/client/src/components/designSystems/appsmith/VideoComponent.tsx

74 lines
1.6 KiB
TypeScript
Raw Normal View History

2020-06-22 13:46:19 +00:00
import React from "react";
import ReactPlayer from "react-player";
import {
Popover,
PopoverInteractionKind,
PopoverPosition,
} from "@blueprintjs/core";
import { ControlIcons } from "icons/ControlIcons";
import styled, { AnyStyledComponent } from "styled-components";
import { Colors } from "constants/Colors";
const PlayerWrapper = styled.div`
width: 600px;
height: 400px;
`;
const PlayIcon = styled(ControlIcons.PLAY_VIDEO as AnyStyledComponent)`
2020-06-22 13:46:19 +00:00
position: relative;
top: 10px;
&:hover {
svg {
path {
fill: ${Colors.POMEGRANATE};
}
}
}
`;
interface VideoComponentProps {
url: string;
}
const VideoComponent = (props: VideoComponentProps) => {
return (
<div onClick={e => e.stopPropagation()}>
<Popover
position={PopoverPosition.AUTO}
interactionKind={PopoverInteractionKind.CLICK}
minimal
usePortal
enforceFocus={false}
lazy={true}
modifiers={{
flip: {
behavior: ["right", "left", "bottom", "top"],
},
keepTogether: {
enabled: false,
},
arrow: {
enabled: false,
},
preventOverflow: {
enabled: true,
boundariesElement: "viewport",
},
}}
>
<PlayIcon width="80" height="52" color="black" />
2020-06-22 13:46:19 +00:00
<PlayerWrapper>
<ReactPlayer
playing={true}
url={props.url}
width="100%"
height="100%"
/>
</PlayerWrapper>
</Popover>
</div>
);
};
export default VideoComponent;